Browse Source

testing returning back to create page if create another location is selected

pull/704/head
JG 3 years ago
parent
commit
8024b2126e
  1. 17
      spec/requests/locations_controller_spec.rb

17
spec/requests/locations_controller_spec.rb

@ -103,6 +103,23 @@ RSpec.describe LocationsController, type: :request do
expect(Location.last.type_of_unit).to eq("Bungalow") expect(Location.last.type_of_unit).to eq("Bungalow")
expect(Location.last.wheelchair_adaptation).to eq("No") expect(Location.last.wheelchair_adaptation).to eq("No")
end end
context "when do you want to add another location is selected as yes" do
it "creates a new location for scheme with valid params and redirects to correct page" do
expect { post "/schemes/#{scheme.id}/location/create", params: }.to change(Location, :count).by(1)
expect(response).to have_http_status(:ok)
expect(page).to have_content("Add a location to this scheme")
end
it "creates a new location for scheme with valid params" do
expect(Location.last.scheme.organisation_id).to eq(user.organisation_id)
expect(Location.last.name).to eq("Test")
expect(Location.last.total_units).to eq(5)
expect(Location.last.type_of_unit).to eq("Bungalow")
expect(Location.last.wheelchair_adaptation).to eq("No")
end
end
end end
end end
end end

Loading…
Cancel
Save