@ -271,7 +271,6 @@ RSpec.describe "Schemes scheme Features" do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /details " )
expect ( page ) . to have_content " Scheme name "
expect ( page ) . to have_content " This scheme contains confidential information "
expect ( page ) . to have_content " Which organisation manages this scheme "
expect ( page ) . to have_content " What is this type of scheme? "
expect ( page ) . to have_content " Who provides the support services used by this scheme? "
expect ( page ) . to have_content " Is this scheme registered under the Care Standards Act 2000? "
@ -480,155 +479,22 @@ RSpec.describe "Schemes scheme Features" do
context " when changing answers " do
it " displays change links " do
assert_selector " a " , text : " Change " , count : 12
assert_selector " a " , text : " Change " , count : 3
end
context " when changing details " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /details ?check_answers=true " , match : :first )
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /edit-name ?check_answers=true " , match : :first )
end
it " allows changing details questions " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /details ?check_answers=true " )
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /edit-name ?check_answers=true " )
fill_in " Scheme name " , with : " Example "
choose " Direct access hostel "
choose " Yes – registered care home providing nursing care "
click_button " Save and continue "
click_button " Save changes "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Example "
expect ( page ) . to have_content " Yes – registered care home providing nursing care "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing primary client group " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /primary-client-group?check_answers=true " )
end
it " allows changing primary-client-group question " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /primary-client-group?check_answers=true " )
choose " Older people with support needs "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Older people with support needs "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing confirm secondary group answer " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
end
it " allows changing confirm-secondary-client-group question to yes " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
choose " Yes "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
choose " People at risk of domestic violence "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " People at risk of domestic violence "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when allows changing confirm-secondary-client-group question to no " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
end
it " allows changing confirm-secondary-client-group question to no " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
choose " No "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . not_to have_content " Secondary client group "
end
end
context " when changing secondary-client-group question " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
end
it " allows changing secondary-client-group question " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
choose " People at risk of domestic violence "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " People at risk of domestic violence "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing support questions " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /support?check_answers=true " , match : :first )
end
it " allows changing support questions " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /support?check_answers=true " )
choose " Resettlement support "
choose " Medium stay "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /locations/new " )
expect ( page ) . to have_content " Add a location to this scheme "
end
context " when I press the back button " do
@ -667,6 +533,7 @@ RSpec.describe "Schemes scheme Features" do
context " when I fill in scheme details indicating that supported services provided by a different organisation and I press save I see primary client group section " do
let ( :scheme ) { Scheme . first }
let! ( :another_organisation ) { FactoryBot . create ( :organisation , name : " Another Org " ) }
before do
fill_in " Scheme name " , with : " FooBar "
@ -699,9 +566,19 @@ RSpec.describe "Schemes scheme Features" do
context " when we amend scheme details " do
it " returns to the primary client group question " do
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /primary-client-group " )
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /support-services-provider " )
end
end
end
context " when I select organisation providing support for scheme " do
before do
select another_organisation . name , from : " scheme-managing-organisation-id-field "
click_button " Save and continue "
end
it " lets me select the primary client group " do
expect ( page ) . to have_content " What client group is this scheme intended for? "
end
context " when I select primary client group details " do
@ -790,6 +667,12 @@ RSpec.describe "Schemes scheme Features" do
context " when I select the support answers " do
before do
fill_in " Postcode " , with : " SW1P 4DF "
fill_in " Location name (optional) " , with : " Some name "
fill_in " Total number of units at this location " , with : 1
choose " Self-contained house "
choose " location-wheelchair-adaptation-no-field "
choose " location-add-another-location-no-field "
choose " Floating support "
choose " Very short stay "
click_button " Save and continue "
@ -819,8 +702,9 @@ RSpec.describe "Schemes scheme Features" do
context " when I add location to the scheme " do
before do
click_link " Add a location "
fill_in " Postcode " , with : " SW1P 4DF "
fill_in " Location n ame (optional)" , with : " Some name "
fill_in " N ame (optional)" , with : " Some name "
fill_in " Total number of units at this location " , with : 1
choose " Self-contained house "
choose " location-wheelchair-adaptation-no-field "
@ -853,7 +737,7 @@ RSpec.describe "Schemes scheme Features" do
before do
click_link " Add a location "
fill_in " Postcode " , with : " XX1 1XX "
fill_in " Location n ame (optional)" , with : " Other name "
fill_in " N ame (optional)" , with : " Other name "
fill_in " Total number of units at this location " , with : 2
choose " Self-contained house "
choose " location-wheelchair-adaptation-no-field "
@ -899,155 +783,22 @@ RSpec.describe "Schemes scheme Features" do
context " when changing answers " do
it " displays change links " do
assert_selector " a " , text : " Change " , count : 12
assert_selector " a " , text : " Change " , count : 3
end
context " when changing details " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /details ?check_answers=true " , match : :first )
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /edit-name ?check_answers=true " , match : :first )
end
it " allows changing details questions " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /details ?check_answers=true " )
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /edit-name ?check_answers=true " )
fill_in " Scheme name " , with : " Example "
choose " Direct access hostel "
choose " Yes – registered care home providing nursing care "
click_button " Save and continue "
click_button " Save changes "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Example "
expect ( page ) . to have_content " Yes – registered care home providing nursing care "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing primary client group " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /primary-client-group?check_answers=true " )
end
it " allows changing primary-client-group question " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /primary-client-group?check_answers=true " )
choose " Older people with support needs "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Older people with support needs "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing confirm secondary group answer " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
end
it " allows changing confirm-secondary-client-group question to yes " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
choose " Yes "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
choose " People at risk of domestic violence "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " People at risk of domestic violence "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when allows changing confirm-secondary-client-group question to no " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
end
it " allows changing confirm-secondary-client-group question to no " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /confirm-secondary-client-group?check_answers=true " )
choose " No "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . not_to have_content " Secondary client group "
end
end
context " when changing secondary-client-group question " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
end
it " allows changing secondary-client-group question " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /secondary-client-group?check_answers=true " )
choose " People at risk of domestic violence "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " People at risk of domestic violence "
end
context " when I press the back button " do
before do
click_link " Back "
end
it " lets me select the support answers " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /check-answers " )
expect ( page ) . to have_content " Check your changes before creating this scheme "
end
end
end
context " when changing support questions " do
before do
click_link ( " Change " , href : " /schemes/ #{ scheme . id } /support?check_answers=true " , match : :first )
end
it " allows changing support questions " do
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /support?check_answers=true " )
choose " Resettlement support "
choose " Medium stay "
click_button " Save and continue "
expect ( page ) . to have_current_path ( " /schemes/ #{ scheme . id } /locations/new " )
expect ( page ) . to have_content " Add a location to this scheme "
end
context " when I press the back button " do
@ -1085,6 +836,7 @@ RSpec.describe "Schemes scheme Features" do
end
end
end
end
context " when editing a scheme " do
context " when I visit schemes page " do