Browse Source

fix some failing specs

pull/705/head
Dushan Despotovic 3 years ago
parent
commit
2d2deb1392
  1. 2
      spec/helpers/tasklist_helper_spec.rb
  2. 2
      spec/models/form/setup/questions/location_spec.rb
  3. 8
      spec/models/form_spec.rb

2
spec/helpers/tasklist_helper_spec.rb

@ -2,7 +2,7 @@ require "rails_helper"
RSpec.describe TasklistHelper do
let(:empty_case_log) { FactoryBot.create(:case_log) }
let(:case_log) { FactoryBot.create(:case_log, :in_progress) }
let(:case_log) { FactoryBot.create(:case_log, :in_progress, needstype: 1) }
describe "get next incomplete section" do
it "returns the first subsection name if it is not completed" do

2
spec/models/form/setup/questions/location_spec.rb

@ -15,7 +15,7 @@ RSpec.describe Form::Setup::Questions::Location, type: :model do
expect(question.id).to eq("location")
end
xit "has the correct header" do
it "has the correct header" do
expect(question.header).to eq("Which location used by #{scheme.service_name} is this log for?")
end

8
spec/models/form_spec.rb

@ -177,8 +177,10 @@ RSpec.describe Form, type: :model do
end
describe "invalidated_page_questions" do
let(:case_log) { FactoryBot.create(:case_log, :in_progress, needstype: 1) }
context "when dependencies are not met" do
let(:expected_invalid) { %w[condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
let(:expected_invalid) { %w[scheme_id location condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
it "returns an array of question keys whose pages conditions are not met" do
expect(form.invalidated_page_questions(case_log).map(&:id).uniq).to eq(expected_invalid)
@ -186,7 +188,7 @@ RSpec.describe Form, type: :model do
end
context "with two pages having the same question and only one has dependencies met" do
let(:expected_invalid) { %w[condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
let(:expected_invalid) { %w[scheme_id location condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
it "returns an array of question keys whose pages conditions are not met" do
case_log["preg_occ"] = "No"
@ -195,7 +197,7 @@ RSpec.describe Form, type: :model do
end
context "when a question is marked as `derived` and `depends_on: false`" do
let(:case_log) { FactoryBot.build(:case_log, :in_progress, startdate: Time.utc(2023, 2, 2, 10, 36, 49)) }
let(:case_log) { FactoryBot.build(:case_log, :in_progress, startdate: Time.utc(2022, 4, 2, 10, 36, 49)) }
it "does not count it's questions as invalidated" do
expect(form.enabled_page_questions(case_log).map(&:id).uniq).to include("tshortfall_known")

Loading…
Cancel
Save