Browse Source

Test inferred check questions of lettings logs

pull/922/head
Jack S 4 years ago
parent
commit
f1eb87f6ee
  1. 6
      spec/fixtures/forms/2021_2022.json
  2. 16
      spec/models/form/question_spec.rb

6
spec/fixtures/forms/2021_2022.json vendored

@ -303,6 +303,12 @@
"leftreg": [
1
]
},
"inferred_check_answers_value": {
"condition": {
"armedforces": 3
},
"value": "Prefers not to say"
}
},
"leftreg": {

16
spec/models/form/question_spec.rb

@ -342,7 +342,20 @@ RSpec.describe Form::Question, type: :model do
end
context "with inferred_check_answers_value" do
let!(:sales_log) { FactoryBot.create(:sales_log, :completed, ethnic_group: 17) }
context "when Lettings form" do
let(:section_id) { "household" }
let(:subsection_id) { "household_needs" }
let(:page_id) { "armed_forces" }
let(:question_id) { "armedforces" }
it "returns the inferred label value" do
lettings_log.armedforces = 3
expect(question.answer_label(lettings_log)).to eq("Prefers not to say")
end
end
context "when Sales form" do
let(:sales_log) { FactoryBot.create(:sales_log, :completed, ethnic_group: 17) }
let(:question) { sales_log.form.get_question("ethnic_group", sales_log) }
it "returns the inferred label value" do
@ -350,6 +363,7 @@ RSpec.describe Form::Question, type: :model do
end
end
end
end
describe ".completed?" do
context "when the question has inferred value only for check answers display" do

Loading…
Cancel
Save