|
|
@ -1,7 +1,6 @@ |
|
|
|
require "rails_helper" |
|
|
|
require "rails_helper" |
|
|
|
RSpec.describe "Test Features" do |
|
|
|
RSpec.describe "Test Features" do |
|
|
|
let!(:case_log) { FactoryBot.create(:case_log, :in_progress) } |
|
|
|
let!(:case_log) { FactoryBot.create(:case_log, :in_progress) } |
|
|
|
let!(:check_answers_case_log) { FactoryBot.create(:case_log, :near_check_answers_household_characteristics) } |
|
|
|
|
|
|
|
let(:id) { case_log.id } |
|
|
|
let(:id) { case_log.id } |
|
|
|
let(:status) { case_log.status } |
|
|
|
let(:status) { case_log.status } |
|
|
|
|
|
|
|
|
|
|
@ -101,18 +100,19 @@ RSpec.describe "Test Features" do |
|
|
|
describe "check answers page" do |
|
|
|
describe "check answers page" do |
|
|
|
let(:subsection) { "household_characteristics" } |
|
|
|
let(:subsection) { "household_characteristics" } |
|
|
|
|
|
|
|
|
|
|
|
context "only one questions remains to be answered for the household characteristics section" do |
|
|
|
context "when the user needs to check their answers for a subsection" do |
|
|
|
# it "redirects to the check answers page when answering the last question and clicking save and continue" do |
|
|
|
|
|
|
|
# visit("/case_logs/#{check_answers_case_log.id}/household_number_of_other_members") |
|
|
|
|
|
|
|
# fill_in("household_number_of_other_members", with: 0) |
|
|
|
|
|
|
|
# click_button("Save and continue") |
|
|
|
|
|
|
|
# expect(page).to have_current_path("/case_logs/#{check_answers_case_log.id}/check-answers") |
|
|
|
|
|
|
|
# end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "can be visited by URL" do |
|
|
|
it "can be visited by URL" do |
|
|
|
visit("case_logs/#{case_log.id}/#{subsection}/check_answers") |
|
|
|
visit("case_logs/#{id}/#{subsection}/check_answers") |
|
|
|
expect(page).to have_content("Check the answers you gave for #{subsection.tr('_', ' ')}") |
|
|
|
expect(page).to have_content("Check the answers you gave for #{subsection.tr('_', ' ')}") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let(:last_question_for_subsection) { "household_number_of_other_members" } |
|
|
|
|
|
|
|
it "redirects to the check answers page when answering the last question and clicking save and continue" do |
|
|
|
|
|
|
|
visit("/case_logs/#{id}/#{last_question_for_subsection}") |
|
|
|
|
|
|
|
fill_in(last_question_for_subsection, with: 0) |
|
|
|
|
|
|
|
click_button("Save and continue") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/case_logs/#{id}/#{subsection}/check_answers") |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|