Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def welsh?
end

def copy_of_answers_enabled?
return false unless Settings.copy_of_answers_enabled
return false unless form_document.respond_to?(:send_copy_of_answers)

form_document.send_copy_of_answers == "enabled"
Expand Down
3 changes: 3 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ show_browser_during_tests: false
cloudwatch_metrics_enabled: false

analytics_enabled: false

# Allows us to globally disable users getting a copy of their answers in the case that One Login is unavailable.
copy_of_answers_enabled: true
10 changes: 10 additions & 0 deletions spec/models/form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@
it "returns true" do
expect(form.copy_of_answers_enabled?).to be true
end

context "when the global copy_of_answers_enabled setting is set to false" do
before do
allow(Settings).to receive(:copy_of_answers_enabled).and_return(false)
end

it "returns false" do
expect(form.copy_of_answers_enabled?).to be false
end
end
end

context "when send_copy_of_answers is \"disabled\"" do
Expand Down