mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 15:06:23 +02:00
Corrected test errors
This commit is contained in:
parent
37c16a067d
commit
ec203df164
2 changed files with 15 additions and 14 deletions
|
@ -8,6 +8,14 @@ class BankTransaction < ApplicationRecord
|
|||
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
||||
}
|
||||
|
||||
def self.ransackable_associations(auth_object = nil)
|
||||
super
|
||||
end
|
||||
|
||||
def self.ransackable_attributes(auth_object = nil)
|
||||
super
|
||||
end
|
||||
|
||||
def binded?
|
||||
account_activity.present?
|
||||
end
|
||||
|
|
|
@ -51,28 +51,21 @@ class InvoiceTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_calculates_subtotal
|
||||
line_item = InvoiceItem.new
|
||||
invoice = Invoice.new(items: [line_item, line_item])
|
||||
|
||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
||||
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||
invoice = Invoice.new(items: [line_item, line_item.dup])
|
||||
assert_equal BigDecimal(5), invoice.subtotal
|
||||
end
|
||||
end
|
||||
|
||||
def test_returns_persisted_total
|
||||
assert_equal BigDecimal('16.50'), @invoice.total
|
||||
end
|
||||
|
||||
def test_calculates_total
|
||||
line_item = InvoiceItem.new
|
||||
invoice = Invoice.new
|
||||
invoice.vat_rate = 10
|
||||
invoice.items = [line_item, line_item]
|
||||
|
||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
||||
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||
invoice = Invoice.new(vat_rate: 10)
|
||||
invoice.items = [line_item, line_item.dup]
|
||||
assert_equal BigDecimal('5.50'), invoice.total
|
||||
end
|
||||
end
|
||||
|
||||
def test_valid_without_buyer_vat_no
|
||||
@invoice.buyer_vat_no = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue