|
|
|
@ -454,7 +454,7 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
expect(page).to have_content("Add a location to this scheme") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when trying to new location to a scheme that belongs to another organisation" do |
|
|
|
|
context "when trying to edit a location that belongs to another organisation" do |
|
|
|
|
let(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let(:another_location) { FactoryBot.create(:location, scheme: another_scheme) } |
|
|
|
|
|
|
|
|
@ -463,6 +463,14 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the requested location does not exist" do |
|
|
|
|
let(:location) { OpenStruct.new(id: (Location.maximum(:id) || 0) + 1) } |
|
|
|
|
|
|
|
|
|
it "returns not found" do |
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
@ -635,6 +643,15 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.type_of_unit.blank")) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the requested location does not exist" do |
|
|
|
|
let(:location) { OpenStruct.new(id: (Location.maximum(:id) || 0) + 1) } |
|
|
|
|
let(:params) { {} } |
|
|
|
|
|
|
|
|
|
it "returns not found" do |
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
@ -1060,6 +1077,14 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(page).to have_content("Location name for #{location.postcode}") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the requested location does not exist" do |
|
|
|
|
let(:location) { OpenStruct.new(id: (Location.maximum(:id) || 0) + 1) } |
|
|
|
|
|
|
|
|
|
it "returns not found" do |
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|