From b73437299c80b5133eedde37bf020b0af48c699e Mon Sep 17 00:00:00 2001 From: merefield Date: Fri, 10 Mar 2023 14:42:42 +0000 Subject: [PATCH] IMPROVE: separate out new tests --- spec/components/custom_wizard/wizard_spec.rb | 27 +++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/spec/components/custom_wizard/wizard_spec.rb b/spec/components/custom_wizard/wizard_spec.rb index 59c0c8c9..591eee8c 100644 --- a/spec/components/custom_wizard/wizard_spec.rb +++ b/spec/components/custom_wizard/wizard_spec.rb @@ -131,9 +131,6 @@ describe CustomWizard::Wizard do expect( CustomWizard::Wizard.new(@permitted_template, trusted_user).permitted? ).to eq(true) - expect( - CustomWizard::Wizard.new(@guests_permitted_template, trusted_user).permitted? - ).to eq(true) end it "permits everyone if everyone is permitted" do @@ -206,6 +203,30 @@ describe CustomWizard::Wizard do end end + context "with subscription and guest wizard" do + before do + enable_subscription("standard") + end + + it "permits admins" do + expect( + CustomWizard::Wizard.new(@guests_permitted_template, admin_user).permitted? + ).to eq(true) + end + + it "permits regular users" do + expect( + CustomWizard::Wizard.new(@guests_permitted_template, user).permitted? + ).to eq(true) + end + + it "permits guests" do + expect( + CustomWizard::Wizard.new(@guests_permitted_template, nil, "guest123").permitted? + ).to eq(true) + end + end + context "submissions" do before do CustomWizard::Submission.new(@wizard, step_1_field_1: "I am a user submission").save