mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 07:26:22 +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)')
|
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?
|
def binded?
|
||||||
account_activity.present?
|
account_activity.present?
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,28 +51,21 @@ class InvoiceTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_calculates_subtotal
|
def test_calculates_subtotal
|
||||||
line_item = InvoiceItem.new
|
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||||
invoice = Invoice.new(items: [line_item, line_item])
|
invoice = Invoice.new(items: [line_item, line_item.dup])
|
||||||
|
|
||||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
|
||||||
assert_equal BigDecimal(5), invoice.subtotal
|
assert_equal BigDecimal(5), invoice.subtotal
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_returns_persisted_total
|
def test_returns_persisted_total
|
||||||
assert_equal BigDecimal('16.50'), @invoice.total
|
assert_equal BigDecimal('16.50'), @invoice.total
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_calculates_total
|
def test_calculates_total
|
||||||
line_item = InvoiceItem.new
|
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||||
invoice = Invoice.new
|
invoice = Invoice.new(vat_rate: 10)
|
||||||
invoice.vat_rate = 10
|
invoice.items = [line_item, line_item.dup]
|
||||||
invoice.items = [line_item, line_item]
|
|
||||||
|
|
||||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
|
||||||
assert_equal BigDecimal('5.50'), invoice.total
|
assert_equal BigDecimal('5.50'), invoice.total
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_valid_without_buyer_vat_no
|
def test_valid_without_buyer_vat_no
|
||||||
@invoice.buyer_vat_no = ''
|
@invoice.buyer_vat_no = ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue