diff --git a/test/models/audit/billing_profile_audit_test.rb b/test/models/audit/billing_profile_audit_test.rb index 8ea19f552..090f963c6 100644 --- a/test/models/audit/billing_profile_audit_test.rb +++ b/test/models/audit/billing_profile_audit_test.rb @@ -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']) diff --git a/test/models/billing_profile_test.rb b/test/models/billing_profile_test.rb index f60d37b00..bf60042ea 100644 --- a/test/models/billing_profile_test.rb +++ b/test/models/billing_profile_test.rb @@ -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) @@ -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 diff --git a/test/system/billing_profiles_test.rb b/test/system/billing_profiles_test.rb index 10641a33c..dff4979bb 100644 --- a/test/system/billing_profiles_test.rb +++ b/test/system/billing_profiles_test.rb @@ -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')