Skip to content

Commit fb55e25

Browse files
authored
Merge pull request #2586 from alphagov/check-feature-flag-for-daily-csv-content
Only show daily CSV content if the feature flag is enabled
2 parents 6ad5722 + a142d9e commit fb55e25

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

app/views/forms/_made_live_form.html.erb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,13 @@
149149
<p><%= t(".how_you_get_completed_forms.submission_format.email.#{submission_format}_html") %></p>
150150
<% end %>
151151

152-
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.daily_csv.title") %></h4>
153-
<% if form_document.send_daily_submission_batch %>
154-
<p><%= t(".how_you_get_completed_forms.daily_csv.enabled") %></p>
155-
<% else %>
156-
<p><%= t(".how_you_get_completed_forms.daily_csv.disabled") %></p>
152+
<% if FeatureService.enabled?(:daily_submission_emails_enabled) %>
153+
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.daily_csv.title") %></h4>
154+
<% if form_document.send_daily_submission_batch %>
155+
<p><%= t(".how_you_get_completed_forms.daily_csv.enabled") %></p>
156+
<% else %>
157+
<p><%= t(".how_you_get_completed_forms.daily_csv.disabled") %></p>
158+
<% end %>
157159
<% end %>
158160

159161
<% if form_document.has_welsh_translation? %>

spec/views/forms/_made_live_form.html.erb_spec.rb

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,29 @@
189189
end
190190
end
191191

192-
context "when send_daily_submission_batch is true" do
193-
let(:send_daily_submission_batch) { true }
192+
context "when the daily_submission_emails_enabled feature is enabled", :feature_daily_submission_emails_enabled do
193+
context "when send_daily_submission_batch is true" do
194+
let(:send_daily_submission_batch) { true }
194195

195-
it "tells the user they getting a daily CSV" do
196-
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
197-
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.enabled"))
196+
it "tells the user they getting a daily CSV" do
197+
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
198+
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.enabled"))
199+
end
198200
end
199-
end
200201

201-
context "when send_daily_submission_batch is false" do
202-
let(:send_daily_submission_batch) { false }
202+
context "when send_daily_submission_batch is false" do
203+
let(:send_daily_submission_batch) { false }
204+
205+
it "tells the user they have not opted to get a daily CSV" do
206+
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
207+
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.disabled"))
208+
end
209+
end
210+
end
203211

204-
it "tells the user they have not opted to get a daily CSV" do
205-
expect(rendered).to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
206-
expect(rendered).to include(I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.disabled"))
212+
context "when the daily_submission_emails_enabled feature is disabled", feature_daily_submission_emails_enabled: false do
213+
it "does not include the daily CSV section" do
214+
expect(rendered).not_to have_css("h4", text: I18n.t("forms.made_live_form.how_you_get_completed_forms.daily_csv.title"))
207215
end
208216
end
209217

0 commit comments

Comments
 (0)