Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Sep 25, 2023
1 parent f30c842 commit 0943822
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/models/audit/billing_profile_audit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_creating_a_billing_profile_creates_a_history_record
city: 'London',
postal_code: 'NW1 6XE',
country_code: 'GB')
billing_profile.save
billing_profile.save(validate: false)

assert(audit_record = Audit::BillingProfile.find_by(object_id: billing_profile.id, action: 'INSERT'))
assert_equal(billing_profile.name, audit_record.new_value['name'])
Expand Down
7 changes: 5 additions & 2 deletions test/models/billing_profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_vat_codes_must_be_unique_per_user
duplicate = @billing_profile.dup

assert_not(duplicate.valid?)
assert_equal(duplicate.errors[:vat_code], ['has already been taken'])
assert(duplicate.errors[:vat_code].include? 'has already been taken')

private_person_profile = billing_profiles(:private_person)

Expand Down Expand Up @@ -150,7 +150,10 @@ def test_if_billing_profile_updated_all_related_issued_invoices_also_updated
assert_equal invoice.billing_vat_code, @billing_profile.vat_code
assert_equal invoice.billing_alpha_two_country_code, @billing_profile.alpha_two_country_code

@billing_profile.update(name: 'New Company Ltd', vat_code: '12345')
@billing_profile.name = 'New Company Ltd'
@billing_profile.vat_code = '12345'
@billing_profile.save(validate: false)

@billing_profile.reload && invoice.reload

invoice = @billing_profile.invoices.first
Expand Down
2 changes: 1 addition & 1 deletion test/system/billing_profiles_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_a_user_can_create_billing_profile_for_a_vat_liable_company
fill_in_address

fill_in('billing_profile[name]', with: 'ACME corporation')
fill_in('billing_profile[vat_code]', with: '1234567890')
fill_in('billing_profile[vat_code]', with: 'IE6388047V')

assert_changes('BillingProfile.count') do
click_link_or_button('Submit')
Expand Down

0 comments on commit 0943822

Please sign in to comment.