|
|
@ -96,7 +96,6 @@ RSpec.describe LocationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
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.scheme.organisation_id).to eq(user.organisation_id) |
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
expect(Location.last.total_units).to eq(5) |
|
|
|
expect(Location.last.total_units).to eq(5) |
|
|
@ -105,14 +104,15 @@ RSpec.describe LocationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", total_units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "Yes" } } } |
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" 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 { post "/schemes/#{scheme.id}/location/create", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
expect(page).to have_content("Add a location to this scheme") |
|
|
|
expect(page).to have_content("Add a location to this scheme") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
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.scheme.organisation_id).to eq(user.organisation_id) |
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
expect(Location.last.total_units).to eq(5) |
|
|
|
expect(Location.last.total_units).to eq(5) |
|
|
|