Browse Source

lint fixes

pull/474/head
Dushan Despotovic 3 years ago
parent
commit
20721435f5
  1. 4
      app/models/form/question.rb
  2. 4
      spec/models/form/question_spec.rb
  3. 7
      spec/models/form/subsection_spec.rb

4
app/models/form/question.rb

@ -65,10 +65,10 @@ class Form::Question
def hidden_in_check_answers?(case_log)
if hidden_in_check_answers.is_a?(Hash)
hidden_in_check_answers["depends_on"].any? do |hsh|
hidden_in_check_answers["depends_on"].any? do |hsh|
hsh.all? { |key, value| case_log[key] == value }
end
else
else
hidden_in_check_answers
end
end

4
spec/models/form/question_spec.rb

@ -354,11 +354,11 @@ RSpec.describe Form::Question, type: :model do
let(:case_log) do
FactoryBot.create(:case_log, :in_progress)
end
it "can work out if the question will be shown in check answers" do
expect(question.hidden_in_check_answers?(case_log)).to be(false)
case_log.layear = 0
expect(question.hidden_in_check_answers?(case_log)).to be(true)
end
end
end
end

7
spec/models/form/subsection_spec.rb

@ -57,18 +57,19 @@ RSpec.describe Form::Subsection, type: :model do
expect(subsection.is_started?(case_log)).to be(true)
end
context "with optional fields" do
context "with optional fields" do
subject(:subsection) { described_class.new(subsection_id, subsection_definition, section) }
let(:section_id) { "tenancy_and_property" }
let(:section_definition) { form.form_definition["sections"][section_id] }
let(:section) { Form::Section.new(section_id, section_definition, form) }
let(:subsection_id) { "property_information" }
let(:subsection_definition) { section_definition["subsections"][subsection_id] }
it "has a started status even if only an optional field has been answered" do
case_log.postcode_known = 0
expect(subsection.is_started?(case_log)).to be(true)
end
end
end
it "has question helpers for the number of applicable questions" do

Loading…
Cancel
Save