|
|
@ -220,6 +220,7 @@ RSpec.describe "Schemes scheme Features" do |
|
|
|
|
|
|
|
|
|
|
|
context "when creating a new scheme" do |
|
|
|
context "when creating a new scheme" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
|
|
|
|
Scheme.destroy_all |
|
|
|
click_link "Schemes", href: "/schemes" |
|
|
|
click_link "Schemes", href: "/schemes" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -289,97 +290,105 @@ RSpec.describe "Schemes scheme Features" do |
|
|
|
it "lets me select level of support" do |
|
|
|
it "lets me select level of support" do |
|
|
|
expect(page).to have_content "What support does this scheme provide?" |
|
|
|
expect(page).to have_content "What support does this scheme provide?" |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when changing answers" do |
|
|
|
context "when I select the support answers" do |
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
before do |
|
|
|
|
|
|
|
choose "Floating support" |
|
|
|
|
|
|
|
choose "Very short stay" |
|
|
|
|
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
it "lets me check my answers" do |
|
|
|
visit "/schemes/#{scheme.id}/check-answers" |
|
|
|
expect(page).to have_content "Check your changes before updating this scheme" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "displays change links" do |
|
|
|
context "when changing answers" do |
|
|
|
assert_selector "a", text: "Change", count: 12 |
|
|
|
let!(:scheme) { Scheme.first } |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "allows changing details questions" do |
|
|
|
it "displays change links" do |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first) |
|
|
|
assert_selector "a", text: "Change", count: 12 |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/details?check_answers=true") |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fill_in "Scheme name", with: "Example" |
|
|
|
it "allows changing details questions" do |
|
|
|
choose "Direct access hostel" |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first) |
|
|
|
choose "Yes – registered care home providing nursing care" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/details?check_answers=true") |
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
fill_in "Scheme name", with: "Example" |
|
|
|
expect(page).to have_content "Example" |
|
|
|
choose "Direct access hostel" |
|
|
|
expect(page).to have_content "Yes – registered care home providing nursing care" |
|
|
|
choose "Yes – registered care home providing nursing care" |
|
|
|
end |
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
|
|
|
|
it "allows changing primary-client-group question" do |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/primary-client-group?check_answers=true") |
|
|
|
expect(page).to have_content "Example" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/primary-client-group?check_answers=true") |
|
|
|
expect(page).to have_content "Yes – registered care home providing nursing care" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
choose "Older people with support needs" |
|
|
|
it "allows changing primary-client-group question" do |
|
|
|
click_button "Save and continue" |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/primary-client-group?check_answers=true") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/primary-client-group?check_answers=true") |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
choose "Older people with support needs" |
|
|
|
expect(page).to have_content "Older people with support needs" |
|
|
|
click_button "Save and continue" |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "allows changing secondary-client-group question" do |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
expect(page).to have_content "Older people with support needs" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
choose "People at risk of domestic violence" |
|
|
|
it "allows changing secondary-client-group question" do |
|
|
|
click_button "Save and continue" |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
choose "People at risk of domestic violence" |
|
|
|
expect(page).to have_content "People at risk of domestic violence" |
|
|
|
click_button "Save and continue" |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "allows changing confirm-secondary-client-group question to yes" do |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
expect(page).to have_content "People at risk of domestic violence" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
choose "Yes" |
|
|
|
it "allows changing confirm-secondary-client-group question to yes" do |
|
|
|
click_button "Save and continue" |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
choose "Yes" |
|
|
|
|
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
|
|
|
|
choose "People at risk of domestic violence" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") |
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
choose "People at risk of domestic violence" |
|
|
|
expect(page).to have_content "People at risk of domestic violence" |
|
|
|
click_button "Save and continue" |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "allows changing confirm-secondary-client-group question to no" do |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
expect(page).to have_content "People at risk of domestic violence" |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
choose "No" |
|
|
|
it "allows changing confirm-secondary-client-group question to no" do |
|
|
|
click_button "Save and continue" |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/confirm-secondary-client-group?check_answers=true") |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
choose "No" |
|
|
|
expect(page).to have_content "None" |
|
|
|
click_button "Save and continue" |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
|
|
|
|
expect(page).to have_content "None" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "allows changing support question to no" do |
|
|
|
it "allows changing support questions" do |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/support?check_answers=true", match: :first) |
|
|
|
click_link("Change", href: "/schemes/#{scheme.id}/support?check_answers=true", match: :first) |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/support?check_answers=true") |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/support?check_answers=true") |
|
|
|
|
|
|
|
|
|
|
|
choose "Resettlement support" |
|
|
|
choose "Resettlement support" |
|
|
|
choose "Medium stay" |
|
|
|
choose "Medium stay" |
|
|
|
click_button "Save and continue" |
|
|
|
click_button "Save and continue" |
|
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") |
|
|
|
expect(page).to have_content "Resettlement support" |
|
|
|
expect(page).to have_content "Resettlement support" |
|
|
|
expect(page).to have_content "Medium stay" |
|
|
|
expect(page).to have_content "Medium stay" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|