From 07a3e83dc6754c2f627e80ab328c1ff5042eb4da Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Mon, 13 Oct 2025 15:11:47 +1100 Subject: [PATCH] Fix enterprise specs Plus small refactor --- app/controllers/admin/enterprises_controller.rb | 1 + spec/system/admin/enterprises_spec.rb | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index 811515fdbc..a32eaf4349 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -85,6 +85,7 @@ module Admin end else load_tag_rule_types + load_tag_rules respond_with(@object) do |format| format.json { render json: { errors: @object.errors.messages }, status: :unprocessable_entity diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index f783cea3b3..a26d515bd3 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -733,19 +733,16 @@ RSpec.describe ' it_behaves_like "edit link with", "openfoodnetwork.org", "http://openfoodnetwork.org" end - shared_examples "edit link with invalid" do |url| - it "url: #{url}" do - fill_in "enterprise_white_label_logo_link", with: url + context "with an invalid link" do + it "can not edit white label logo link" do + fill_in "enterprise_white_label_logo_link", with: "invalid url" click_button 'Update' - expect(page) - .to have_content "Link for the logo used in shopfront '#{url}' is an invalid URL" + expect(page).to have_content( + "Link for the logo used in shopfront 'invalid url' is an invalid URL" + ) expect(distributor1.reload.white_label_logo_link).to be_nil end end - - context "can not edit white label logo link" do - it_behaves_like "edit link with invalid", "invalid url" - end end it "can check/uncheck the hide_groups_tab attribute" do