Skip to content

Commit c2c3784

Browse files
committed
Update specs to set feature flag for CopyOfAnswers
1 parent 17e1322 commit c2c3784

10 files changed

Lines changed: 17 additions & 2 deletions

spec/features/email_confirmation_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
ActiveResource::HttpMock.respond_to do |mock|
1414
mock.get "/api/v2/forms/1/live", req_headers, form.to_json, 200
1515
end
16+
17+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
1618
end
1719

1820
scenario "opting out of email submission returns the confirmation page without confirmation email text" do

spec/features/fill_in_and_submit_form_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
end
1717

1818
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
19+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
1920
end
2021

2122
scenario "As a form filler" do

spec/features/fill_in_and_submit_form_with_csv_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
end
1818

1919
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
20+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
2021

2122
travel_to Time.parse("2029-01-24T05:05:50+00:00")
2223
end

spec/features/fill_in_autocomplete_question_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
end
1818

1919
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
20+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
2021
end
2122

2223
scenario "As a form filler" do

spec/features/fill_in_file_upload_question_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
allow(mock_s3_client).to receive(:put_object)
3737
allow(mock_s3_client).to receive(:get_object_tagging).and_return({ tag_set: [{ key: "GuardDutyMalwareScanStatus", value: scan_status }] })
3838

39+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
40+
3941
File.write(test_file, test_file_content)
4042
end
4143

spec/features/fill_in_form_with_exit_page_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
end
1717

1818
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
19+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
1920
end
2021

2122
scenario "As a form filler" do

spec/features/fill_in_single_repeatable_form_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
end
1919

2020
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
21+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
2122
end
2223

2324
scenario "As a form filler" do

spec/requests/forms/check_your_answers_controller_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
end
102102

103103
allow(ReferenceNumberService).to receive(:generate).and_return(reference)
104+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
104105
end
105106

106107
describe "#show" do

spec/requests/forms/copy_of_answers_controller_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
allow(Flow::Context).to receive(:new).and_wrap_original do |original_method, *args|
3939
original_method.call(form: args[0][:form], store:)
4040
end
41+
42+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
4143
end
4244

4345
describe "GET #show" do
@@ -48,7 +50,6 @@
4850
context "when the feature flag is disabled" do
4951
before do
5052
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(false)
51-
get copy_of_answers_path(mode:, form_id: form.form_id, form_slug: form.form_slug)
5253
end
5354

5455
it "redirects to check your answers" do
@@ -151,7 +152,9 @@
151152
end
152153

153154
it "displays an error message" do
154-
expect(response.body).to include(I18n.t("activemodel.errors.models.copy_of_answers_input.attributes.copy_of_answers.blank"))
155+
expect(response.body).to include("Select")
156+
expect(response.body).to include("Yes")
157+
expect(response.body).to include("copy of your answers")
155158
end
156159
end
157160
end

spec/requests/forms/page_controller_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
ActiveResource::HttpMock.respond_to do |mock|
5353
mock.get "/api/v2/forms/2#{api_url_suffix}", req_headers, form_data.to_json, 200
5454
end
55+
56+
allow(FeatureService).to receive(:enabled?).with("filler_answer_email_enabled").and_return(true)
5557
end
5658

5759
context "when setting logging context" do

0 commit comments

Comments
 (0)