diff --git a/app/models/bank_transaction.rb b/app/models/bank_transaction.rb index bd437fe96..f5c31c964 100644 --- a/app/models/bank_transaction.rb +++ b/app/models/bank_transaction.rb @@ -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 diff --git a/test/models/invoice_test.rb b/test/models/invoice_test.rb index 344af9dcc..586f467a8 100644 --- a/test/models/invoice_test.rb +++ b/test/models/invoice_test.rb @@ -51,12 +51,9 @@ 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 - assert_equal BigDecimal(5), invoice.subtotal - end + 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 def test_returns_persisted_total @@ -64,14 +61,10 @@ class InvoiceTest < ActiveSupport::TestCase 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 - assert_equal BigDecimal('5.50'), invoice.total - end + 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 def test_valid_without_buyer_vat_no