Browse Source

Linting

pull/31/head
baarkerlounger 4 years ago
parent
commit
42ea2c9230
  1. 2
      app/helpers/check_answers_helper.rb
  2. 7
      spec/helpers/check_answers_helper_spec.rb

2
app/helpers/check_answers_helper.rb

@ -26,7 +26,9 @@ module CheckAnswersHelper
def condition_not_met(case_log, question_key, question, condition)
case question["type"]
when "numeric"
# rubocop:disable Security/Eval
case_log[question_key].blank? || !eval(case_log[question_key].to_s + condition)
# rubocop:enable Security/Eval
when "radio"
case_log[question_key].blank? || !condition.include?(case_log[question_key])
else

7
spec/helpers/check_answers_helper_spec.rb

@ -7,7 +7,7 @@ RSpec.describe CheckAnswersHelper do
:case_log,
:in_progress,
household_number_of_other_members: 2,
person_2_relationship: "Partner"
person_2_relationship: "Partner",
)
end
let(:case_log_with_met_radio_condition) do
@ -88,14 +88,13 @@ RSpec.describe CheckAnswersHelper do
"hint_text" => "",
"type" => "date",
"check_answer_label" => "Question Label",
"conditional_for"=>{"question_2"=>["12-12-2021"]}},
"conditional_for" => { "question_2" => %w[12-12-2021] } },
"question_2" =>
{ "header" => "The second actual question?",
"hint_text" => "",
"type" => "radio",
"check_answer_label" => "The second question label",
"answer_options"=>{"0"=>"Yes", "1"=>"No"}}
}
"answer_options" => { "0" => "Yes", "1" => "No" } } }
end
it "raises an error" do

Loading…
Cancel
Save