Browse Source

added test to add another location from locations page

pull/704/head
JG 3 years ago
parent
commit
516e1739ee
  1. 42
      spec/features/schemes_spec.rb

42
spec/features/schemes_spec.rb

@ -389,7 +389,7 @@ RSpec.describe "Schemes scheme Features" 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
context "when we amend support" do context "when I amend support" do
it "returns to the add location page" do it "returns to the add location page" do
click_button "Save and continue" click_button "Save and continue"
expect(page).to have_current_path("/schemes/#{scheme.id}/location/new") expect(page).to have_current_path("/schemes/#{scheme.id}/location/new")
@ -421,6 +421,46 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Locations" expect(page).to have_content "Locations"
expect(page).to have_content "#{scheme.locations.count} location" expect(page).to have_content "#{scheme.locations.count} location"
end end
it "displays information about newly created location" do
expect(page).to have_content "SW1P4DF"
expect(page).to have_content "Some name"
expect(page).to have_content "Self-contained house"
end
end
context "and I select to add another location a scheme" do
before do
click_link "Add a location"
fill_in "Postcode", with: "XX1 1XX"
fill_in "Name (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"
choose "location-add-another-location-no-field"
click_button "Save and continue"
end
it "lets me check my answers" do
expect(page).to have_content "Check your changes before creating this scheme"
end
context "when I select to view locations" do
before do
click_link "Locations"
end
it "displays information about another location" do
expect(page).to have_content "Locations"
expect(page).to have_content "#{scheme.locations.count} location"
end
it "displays information about newly created location" do
expect(page).to have_content "XX11XX"
expect(page).to have_content "Other name"
expect(page).to have_content "Self-contained house"
end
end
end end
context "and I select to create a scheme" do context "and I select to create a scheme" do

Loading…
Cancel
Save