Fix enterprise specs

Plus small refactor
This commit is contained in:
Gaetan Craig-Riou
2025-10-13 15:11:47 +11:00
parent 38f58b168a
commit 07a3e83dc6
2 changed files with 7 additions and 9 deletions

View File

@@ -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

View File

@@ -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