Browse Source

remove debug line and rubocop

pull/78/head
magicmilo 3 years ago
parent
commit
0d82814fee
  1. 2
      app/controllers/case_logs_controller.rb
  2. 3
      app/helpers/check_answers_helper.rb
  3. 4
      spec/helpers/check_answers_helper_spec.rb
  4. 5
      spec/models/case_log_spec.rb

2
app/controllers/case_logs_controller.rb

@ -136,7 +136,7 @@ private
content["conditional_route_to"].each do |route, conditions| content["conditional_route_to"].each do |route, conditions|
if conditions.keys.all? { |x| case_log[x].present? } && conditions.all? { |k, v| v.include?(case_log[k]) } if conditions.keys.all? { |x| case_log[x].present? } && conditions.all? { |k, v| v.include?(case_log[k]) }
return "case_log_#{route}_path" return "case_log_#{route}_path"
end end
end end
end end
form.next_page_redirect_path(previous_page) form.next_page_redirect_path(previous_page)

3
app/helpers/check_answers_helper.rb

@ -28,7 +28,6 @@ module CheckAnswersHelper
def filter_conditional_questions(questions, case_log) def filter_conditional_questions(questions, case_log)
applicable_questions = questions applicable_questions = questions
# puts applicable_questions.count
questions.each do |k, question| questions.each do |k, question|
question.fetch("conditional_for", []).each do |conditional_question_key, condition| question.fetch("conditional_for", []).each do |conditional_question_key, condition|
if condition_not_met(case_log, k, question, condition) if condition_not_met(case_log, k, question, condition)
@ -62,7 +61,7 @@ module CheckAnswersHelper
when "radio" when "radio"
case_log[question_key].blank? || !condition.include?(case_log[question_key]) case_log[question_key].blank? || !condition.include?(case_log[question_key])
else else
raise "Not implemented yet" end raise "Not implemented yet" end
end end
def create_update_answer_link(case_log_answer, case_log_id, page) def create_update_answer_link(case_log_answer, case_log_id, page)

4
spec/helpers/check_answers_helper_spec.rb

@ -98,9 +98,7 @@ RSpec.describe CheckAnswersHelper do
"hint_text" => "", "hint_text" => "",
"type" => "date", "type" => "date",
"check_answer_label" => "Question Label", "check_answer_label" => "Question Label",
"conditional_for" => { "question_2" => %w[12-12-2021] } "conditional_for" => { "question_2" => %w[12-12-2021] } } }
}
}
end end
it "raises an error" do it "raises an error" do

5
spec/models/case_log_spec.rb

@ -198,10 +198,11 @@ RSpec.describe Form, type: :model do
# Crossover over tests here as injured must be answered as well for no error # Crossover over tests here as injured must be answered as well for no error
it "must be answered if ever served in the forces as a regular" do it "must be answered if ever served in the forces as a regular" do
expect { expect do
CaseLog.create!(armed_forces: "Yes - a regular", CaseLog.create!(armed_forces: "Yes - a regular",
armed_forces_active: "Yes", armed_forces_active: "Yes",
armed_forces_injured: "Yes")} armed_forces_injured: "Yes")
end
end end
end end

Loading…
Cancel
Save