|
|
|
@ -81,7 +81,7 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, organisation: user.organisation) } |
|
|
|
|
let(:params) { { location: { name: "Test", total_units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "No" } } } |
|
|
|
|
let(:params) { { location: { name: "Test", total_units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "No", postcode: "ZZ1 1ZZ" } } } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
@ -104,7 +104,7 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
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" } } } |
|
|
|
|
let(:params) { { location: { name: "Test", total_units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "Yes", postcode: "ZZ1 1ZZ" } } } |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|