Set visible to only_through_links on enterprise registration

This commit is contained in:
Jean-Baptiste Bellet
2023-07-25 10:52:14 +02:00
parent 7aed068bb7
commit 5a0d4d2a93
2 changed files with 6 additions and 1 deletions

View File

@@ -92,7 +92,7 @@ module Admin
return render :welcome, layout: "spree/layouts/bare_admin"
end
attributes = { sells: register_params[:sells], visible: true }
attributes = { sells: register_params[:sells], visible: "only_through_links" }
if @enterprise.update(attributes)
flash[:success] = I18n.t(:enterprise_register_success_notice, enterprise: @enterprise.name)

View File

@@ -453,6 +453,11 @@ describe Admin::EnterprisesController, type: :controller do
expect(flash[:error]).to eq "Please select a package"
end
end
it "set visibility to 'only_through_links' by default" do
spree_post :register, id: enterprise, sells: 'none'
expect(enterprise.reload.visible).to eq 'only_through_links'
end
end
end