From dd74989562edaf418e191f7a2a96927ee24f8b45 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 28 Jul 2022 20:37:10 +0100 Subject: [PATCH] Remove out of date specs --- .../custom_wizard/submission_spec.rb | 2 +- spec/components/custom_wizard/wizard_spec.rb | 9 ---- .../custom_wizard/wizard_serializer_spec.rb | 52 ------------------- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/spec/components/custom_wizard/submission_spec.rb b/spec/components/custom_wizard/submission_spec.rb index 5a86eca6..a406d606 100644 --- a/spec/components/custom_wizard/submission_spec.rb +++ b/spec/components/custom_wizard/submission_spec.rb @@ -40,7 +40,7 @@ describe CustomWizard::Submission do expect(described_class.list(@wizard, user_id: user.id).size).to eq(1) end - context "#cleanup_incomplete_submissions" do + describe "#cleanup_incomplete_submissions" do it "cleans up redundant incomplete submissions on each build" do freeze_time Time.now + 1 described_class.new(@wizard, step_1_field_1: "I am the second submission").save diff --git a/spec/components/custom_wizard/wizard_spec.rb b/spec/components/custom_wizard/wizard_spec.rb index a3f86f3e..cf366f43 100644 --- a/spec/components/custom_wizard/wizard_spec.rb +++ b/spec/components/custom_wizard/wizard_spec.rb @@ -192,15 +192,6 @@ describe CustomWizard::Wizard do ).to eq(false) end - it "lists the site groups" do - expect(@wizard.groups.length).to eq(8) - end - - it "lists the site categories" do - Site.clear_cache - expect(@wizard.categories.length).to eq(1) - end - context "submissions" do before do CustomWizard::Submission.new(@wizard, step_1_field_1: "I am a user submission").save diff --git a/spec/serializers/custom_wizard/wizard_serializer_spec.rb b/spec/serializers/custom_wizard/wizard_serializer_spec.rb index 1b26ce24..7fcf0117 100644 --- a/spec/serializers/custom_wizard/wizard_serializer_spec.rb +++ b/spec/serializers/custom_wizard/wizard_serializer_spec.rb @@ -47,56 +47,4 @@ describe CustomWizard::WizardSerializer do json[:wizard][:user] ).to eq(BasicUserSerializer.new(user, root: false).as_json) end - - it "should not return categories if there are no category fields" do - @template[:steps][2][:fields].delete_at(2) - CustomWizard::Template.save(@template) - - json = CustomWizard::WizardSerializer.new( - CustomWizard::Builder.new(@template[:id], user).build, - scope: Guardian.new(user) - ).as_json - expect(json[:wizard][:categories].present?).to eq(false) - expect(json[:wizard][:uncategorized_category_id].present?).to eq(false) - end - - it "should return categories if there is a category selector field" do - json = CustomWizard::WizardSerializer.new( - CustomWizard::Builder.new(@template[:id], user).build, - scope: Guardian.new(user) - ).as_json - expect(json[:wizard][:categories].present?).to eq(true) - expect(json[:wizard][:uncategorized_category_id].present?).to eq(true) - end - - it "should return categories if there is a similar topics validation scoped to category(s)" do - @template[:steps][0][:fields][0][:validations] = similar_topics_validation[:validations] - CustomWizard::Template.save(@template) - - json = CustomWizard::WizardSerializer.new( - CustomWizard::Builder.new(@template[:id], user).build, - scope: Guardian.new(user) - ).as_json - expect(json[:wizard][:categories].present?).to eq(true) - expect(json[:wizard][:uncategorized_category_id].present?).to eq(true) - end - - it 'should return groups if there is a group selector field' do - json = CustomWizard::WizardSerializer.new( - CustomWizard::Builder.new(@template[:id], user).build, - scope: Guardian.new(user) - ).as_json - expect(json[:wizard][:groups].length).to eq(8) - end - - it 'should not return groups if there is not a group selector field' do - @template[:steps][2][:fields].delete_at(3) - CustomWizard::Template.save(@template) - - json = CustomWizard::WizardSerializer.new( - CustomWizard::Builder.new(@template[:id], user).build, - scope: Guardian.new(user) - ).as_json - expect(json[:wizard][:groups].present?).to eq(false) - end end