mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
Can set producer_profile_only using welcome page
This commit is contained in:
@@ -110,7 +110,7 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
describe "setting 'sells' on an enterprise" do
|
||||
describe "set_sells" do
|
||||
let(:enterprise) { create(:enterprise, sells: 'none') }
|
||||
|
||||
before do
|
||||
@@ -131,9 +131,18 @@ module Admin
|
||||
|
||||
context "allows setting 'sells' to 'none'" do
|
||||
it "is allowed" do
|
||||
spree_post :set_sells, { id: enterprise.id, sells: 'own' }
|
||||
spree_post :set_sells, { id: enterprise.id, sells: 'none' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(flash[:success]).to eq "Congratulations! Registration for #{enterprise.name} is complete!"
|
||||
expect(enterprise.reload.sells).to eq 'none'
|
||||
end
|
||||
|
||||
context "setting producer_profile_only to true" do
|
||||
it "is allowed" do
|
||||
spree_post :set_sells, { id: enterprise.id, sells: 'none', producer_profile_only: true }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.producer_profile_only).to eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,6 +167,14 @@ module Admin
|
||||
expect(enterprise.reload.shop_trial_start_date).to be > Time.now-(1.minute)
|
||||
end
|
||||
end
|
||||
|
||||
context "setting producer_profile_only to true" do
|
||||
it "is ignored" do
|
||||
spree_post :set_sells, { id: enterprise.id, sells: 'own', producer_profile_only: true }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.producer_profile_only).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "setting 'sells' to any" do
|
||||
|
||||
Reference in New Issue
Block a user