Skip to content

Commit 3138cd0

Browse files
authored
Merge pull request #2180 from govuk-forms/add-setting-to-disable-copy-of-answers
Add setting to globally disable asking for a copy of answers
2 parents 4aa381a + 9b2351f commit 3138cd0

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

app/models/form.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def welsh?
6565
end
6666

6767
def copy_of_answers_enabled?
68+
return false unless Settings.copy_of_answers_enabled
6869
return false unless form_document.respond_to?(:send_copy_of_answers)
6970

7071
form_document.send_copy_of_answers == "enabled"

config/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ show_browser_during_tests: false
7474
cloudwatch_metrics_enabled: false
7575

7676
analytics_enabled: false
77+
78+
# Allows us to globally disable users getting a copy of their answers in the case that One Login is unavailable.
79+
copy_of_answers_enabled: true

spec/models/form_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@
186186
it "returns true" do
187187
expect(form.copy_of_answers_enabled?).to be true
188188
end
189+
190+
context "when the global copy_of_answers_enabled setting is set to false" do
191+
before do
192+
allow(Settings).to receive(:copy_of_answers_enabled).and_return(false)
193+
end
194+
195+
it "returns false" do
196+
expect(form.copy_of_answers_enabled?).to be false
197+
end
198+
end
189199
end
190200

191201
context "when send_copy_of_answers is \"disabled\"" do

0 commit comments

Comments
 (0)