Skip to content

Commit

Permalink
Rename fixture, remove defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed Mar 14, 2019
1 parent c3981fb commit 79c7501
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/account_activities.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
one:
account: cash
invoice: valid
invoice: one
bank_transaction: one
created_at: <%= Time.zone.parse('2010-07-05 10:00') %>
2 changes: 1 addition & 1 deletion test/fixtures/invoice_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ one:
price: 5
quantity: 1
unit: pc
invoice: valid
invoice: one
17 changes: 11 additions & 6 deletions test/fixtures/invoices.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEFAULTS: &DEFAULTS
one:
issue_date: <%= Date.parse '2010-07-05' %>
due_date: <%= Date.parse '2010-07-06' %>
currency: EUR
Expand All @@ -10,10 +10,15 @@ DEFAULTS: &DEFAULTS
total: 16.50
reference_no: 13

valid:
<<: *DEFAULTS

for_payments_test:
<<: *DEFAULTS
total: 12.00
number: 1
issue_date: <%= Date.parse '2010-07-05' %>
due_date: <%= Date.parse '2010-07-06' %>
currency: EUR
seller_name: John Doe
seller_iban: 1234
buyer: bestnames
buyer_name: Jane Doe
vat_rate: 0.1
reference_no: 13
total: 12.00
8 changes: 4 additions & 4 deletions test/models/bank_transaction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class BankTransactionTest < ActiveSupport::TestCase
def test_matches_against_invoice_reference_number
invoices(:valid).update!(account_activity: nil, number: '2222', total: 10, reference_no: '1111')
invoices(:one).update!(account_activity: nil, number: '2222', total: 10, reference_no: '1111')
transaction = BankTransaction.new(description: 'invoice #2222', sum: 10, reference_no: '1111')

assert_difference 'AccountActivity.count' do
Expand All @@ -20,7 +20,7 @@ def test_does_not_match_against_registrar_reference_number
end

def test_underpayment_is_not_matched_with_invoice
invoices(:valid).update!(account_activity: nil, number: '2222', total: 10)
invoices(:one).update!(account_activity: nil, number: '2222', total: 10)
transaction = BankTransaction.new(sum: 9)

assert_no_difference 'AccountActivity.count' do
Expand All @@ -30,7 +30,7 @@ def test_underpayment_is_not_matched_with_invoice
end

def test_overpayment_is_not_matched_with_invoice
invoices(:valid).update!(account_activity: nil, number: '2222', total: 10)
invoices(:one).update!(account_activity: nil, number: '2222', total: 10)
transaction = BankTransaction.new(sum: 11)

assert_no_difference 'AccountActivity.count' do
Expand All @@ -40,7 +40,7 @@ def test_overpayment_is_not_matched_with_invoice
end

def test_cancelled_invoice_is_not_matched
invoices(:valid).update!(account_activity: nil, number: '2222', total: 10, cancelled_at: '2010-07-05')
invoices(:one).update!(account_activity: nil, number: '2222', total: 10, cancelled_at: '2010-07-05')
transaction = BankTransaction.new(sum: 10)

assert_no_difference 'AccountActivity.count' do
Expand Down
2 changes: 1 addition & 1 deletion test/models/invoice/cancellable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CancellableInvoiceTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_non_cancelled_scope_returns_non_cancelled_invoices
Expand Down
2 changes: 1 addition & 1 deletion test/models/invoice/payable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class InvoiceTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_unpaid_scope_returns_unpaid_invoices
Expand Down
2 changes: 1 addition & 1 deletion test/models/invoice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class InvoiceTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_fixture_is_valid
Expand Down
2 changes: 1 addition & 1 deletion test/services/overdue_invoice_canceller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class OverdueInvoiceCancellerTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_default_delay
Expand Down
2 changes: 1 addition & 1 deletion test/system/admin_area/invoices_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class AdminAreaInvoicesTest < ApplicationSystemTestCase
setup do
sign_in users(:admin)
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_cancels_an_invoice
Expand Down
2 changes: 1 addition & 1 deletion test/system/registrar_area/invoices/list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ListInvoicesTest < ApplicationSystemTestCase
@user = users(:api_bestnames)
sign_in @user

@invoice = invoices(:valid)
@invoice = invoices(:one)
eliminate_effect_of_other_invoices
end

Expand Down
2 changes: 1 addition & 1 deletion test/system/registrar_area/invoices_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class RegistrarAreaInvoicesTest < ApplicationSystemTestCase
setup do
sign_in users(:api_bestnames)
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_cancels_an_invoice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class PopulateInvoiceIssueDateTaskTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
end

def test_populates_invoice_issue_date
Expand Down
2 changes: 1 addition & 1 deletion test/tasks/invoices/cancel_overdue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CancelOverdueInvoicesTaskTest < ActiveSupport::TestCase
setup do
@invoice = invoices(:valid)
@invoice = invoices(:one)
eliminate_effect_of_other_invoices
end

Expand Down

0 comments on commit 79c7501

Please sign in to comment.