From 193be721190106257c9290c0e73c375a75a3d9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Turbelin?= Date: Thu, 28 Nov 2024 23:18:10 +0100 Subject: [PATCH] Repair specs --- app/views/admin/enterprises/_new_form.html.haml | 10 +++++----- config/locales/en.yml | 1 + spec/controllers/api/v0/enterprises_controller_spec.rb | 9 ++++----- spec/system/admin/enterprises_spec.rb | 4 ++++ spec/system/admin/reports/revenues_by_hub_spec.rb | 4 ++++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/views/admin/enterprises/_new_form.html.haml b/app/views/admin/enterprises/_new_form.html.haml index 6964c190323..a1d12ac4924 100644 --- a/app/views/admin/enterprises/_new_form.html.haml +++ b/app/views/admin/enterprises/_new_form.html.haml @@ -28,21 +28,21 @@ .row .alpha.eleven.columns .three.columns.alpha - = f.label :sells, t('primary_details.sells', scope: scope) - %div{'ofn-with-tip' => t('primary_details.sells_tip', scope: scope)} + = f.label :sells, t('admin_only.sells', scope: scope) + %div{'ofn-with-tip' => t('admin_only.sells_tip', scope: scope)} %a What's this? .two.columns = f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'   - = f.label :sells, t('primary_details.none', scope: scope), value: "none" + = f.label :sells, t('admin_only.none', scope: scope), value: "none" .two.columns = f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'   - = f.label :sells, t('primary_details.own', scope: scope), value: "own" + = f.label :sells, t('admin_only.own', scope: scope), value: "own" .four.columns.omega = f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'   - = f.label :sells, t('primary_details.any', scope: scope), value: "any" + = f.label :sells, t('admin_only.any', scope: scope), value: "any" .row .alpha.three.columns diff --git a/config/locales/en.yml b/config/locales/en.yml index c6fba5bbb73..2a0cc9ed91d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1718,6 +1718,7 @@ en: enterprise: primary_details: "Primary Details" address: "Address" + admin_only: "Admin Only" contact: "Contact" social: "Social" about: "About" diff --git a/spec/controllers/api/v0/enterprises_controller_spec.rb b/spec/controllers/api/v0/enterprises_controller_spec.rb index 8a74176ff07..55fd6a2a158 100644 --- a/spec/controllers/api/v0/enterprises_controller_spec.rb +++ b/spec/controllers/api/v0/enterprises_controller_spec.rb @@ -8,7 +8,7 @@ let(:enterprise) { create(:distributor_enterprise) } context "as an admin user" do - let(:admin) { create(:user) } + let(:admin) { create(:admin_user) } let!(:enterprise) { create(:distributor_enterprise) } before do @@ -18,13 +18,12 @@ describe "updating an enterprise" do let(:enterprise_params) do { - enterprise_id: enterprise.id, - enterprise: { external_billing_id: 'INV123456' } + external_billing_id: 'INV123456' } end - it "creates a visible=hidden enterprise" do - api_post :create, enterprise_params + it "changes the external_billing_id field" do + api_put :update, id: enterprise.id, enterprise: enterprise_params expect(response.status).to eq 200 expect(enterprise.reload.external_billing_id).to eq('INV123456') diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index 86d007a46b5..2cd8b23e883 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -86,6 +86,10 @@ end fill_in 'enterprise_name', with: 'Eaterprises' + + accept_alert do + click_link "Admin Only" + end fill_in 'enterprise_permalink', with: 'eaterprises-permalink' expect(page).to have_selector '.available' choose 'Own' diff --git a/spec/system/admin/reports/revenues_by_hub_spec.rb b/spec/system/admin/reports/revenues_by_hub_spec.rb index 114ec2e4115..8af7951ba94 100644 --- a/spec/system/admin/reports/revenues_by_hub_spec.rb +++ b/spec/system/admin/reports/revenues_by_hub_spec.rb @@ -64,6 +64,7 @@ "Hub", "Hub ID", "Hub Business Number", + "Hub External Billing Id", "Hub Legal Name", "Hub Contact Name", "Hub Public Email", @@ -89,6 +90,7 @@ "none", "none", "none", + "none", "email@email.com", "none", "10 Lovely Street", @@ -110,6 +112,7 @@ "none", "none", "none", + "none", "email@email.com", "none", "10 Lovely Street", @@ -131,6 +134,7 @@ "none", "none", "none", + "none", "email@email.com", "none", "10 Lovely Street",