From 89f733ae324666ea69599b65513b0f28015650d3 Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Thu, 12 Aug 2021 17:11:58 +0530 Subject: [PATCH] added spec to verify functionality --- spec/requests/custom_wizard/wizard_controller_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/requests/custom_wizard/wizard_controller_spec.rb b/spec/requests/custom_wizard/wizard_controller_spec.rb index f2000bda..34628bda 100644 --- a/spec/requests/custom_wizard/wizard_controller_spec.rb +++ b/spec/requests/custom_wizard/wizard_controller_spec.rb @@ -76,4 +76,14 @@ describe CustomWizard::WizardController do put '/w/super-mega-fun-wizard/skip.json' expect(response.parsed_body['redirect_to']).to eq('/t/2') end + + it "deletes the submission if user has filled up some data" do + @wizard = CustomWizard::Wizard.create(@template["id"], user) + CustomWizard::Submission.new(@wizard, step_1_field_1: "Hello World").save + current_submission = @wizard.current_submission + put '/w/super-mega-fun-wizard/skip.json' + list = CustomWizard::Submission.list(@wizard) + + expect(list.any? { |submission| submission.id == current_submission.id }).to eq(false) + end end