From 33df6f9fbc71a69ac2b79b9331a015e6e5453802 Mon Sep 17 00:00:00 2001 From: angusmcleod Date: Wed, 16 Jun 2021 14:24:07 +1000 Subject: [PATCH] Add test for skip when cant access --- .../custom_wizard/wizard_controller_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/requests/custom_wizard/wizard_controller_spec.rb b/spec/requests/custom_wizard/wizard_controller_spec.rb index 3e7ddd3d..4380bc73 100644 --- a/spec/requests/custom_wizard/wizard_controller_spec.rb +++ b/spec/requests/custom_wizard/wizard_controller_spec.rb @@ -11,6 +11,14 @@ describe CustomWizard::WizardController do ) } + let(:permitted_json) { + JSON.parse( + File.open( + "#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/wizard/permitted.json" + ).read + ) + } + before do CustomWizard::Template.save( JSON.parse(File.open( @@ -47,6 +55,14 @@ describe CustomWizard::WizardController do expect(response.status).to eq(200) end + it 'lets user skip if user cant access wizard' do + @template["permitted"] = permitted_json["permitted"] + CustomWizard::Template.save(@template, skip_jobs: true) + + put '/w/super-mega-fun-wizard/skip.json' + expect(response.status).to eq(200) + end + it 'returns a no skip message if user is not allowed to skip' do @template['required'] = 'true' CustomWizard::Template.save(@template)