From 5706cecf26256cee35525f665f4274f34d630fdc Mon Sep 17 00:00:00 2001 From: Rory Trunkhill Date: Thu, 17 May 2018 18:10:35 +0000 Subject: [PATCH] modify enterprise eror name message #620 --- config/locales/en.yml | 2 +- spec/models/enterprise_spec.rb | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index c13de7611d..968fd0a06b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2208,7 +2208,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using content_configuration_pricing_table: "(TODO: Pricing table)" content_configuration_case_studies: "(TODO: Case studies)" content_configuration_detail: "(TODO: Detail)" - enterprise_name_error: "has already been taken. If this is your enterprise and you would like to claim ownership, please contact the current manager of this profile at %{email}." + enterprise_name_error: "has already been taken. If this is your enterprise and you would like to claim ownership, or if you would like to trade with this enterprise please contact the current manager of this profile at %{email}." enterprise_owner_error: "^%{email} is not permitted to own any more enterprises (limit is %{enterprise_limit})." enterprise_role_uniqueness_error: "^That role is already present." inventory_item_visibility_error: must be true or false diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index 3f598c2ea0..890c1a987d 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -129,17 +129,15 @@ describe Enterprise do it "prevents duplicate names for new records" do e = Enterprise.new name: enterprise.name - e.should_not be_valid - e.errors[:name].first.should == - "has already been taken. If this is your enterprise and you would like to claim ownership, please contact the current manager of this profile at owner@example.com." + expect(e).to_not be_valid + expect(e.errors[:name].first).to include I18n.t('enterprise_name_error', email: owner.email) end it "prevents duplicate names for existing records" do e = create(:enterprise, name: 'foo') e.name = enterprise.name - e.should_not be_valid - e.errors[:name].first.should == - "has already been taken. If this is your enterprise and you would like to claim ownership, please contact the current manager of this profile at owner@example.com." + expect(e).to_not be_valid + expect(e.errors[:name].first).to include I18n.t('enterprise_name_error', email: owner.email) end it "does not prohibit the saving of an enterprise with no name clash" do