|
|
|
@ -72,404 +72,6 @@ RSpec.describe LocationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#create" do |
|
|
|
|
|
|
|
context "when not signed in" do |
|
|
|
|
|
|
|
it "redirects to the sign in page" do |
|
|
|
|
|
|
|
post "/schemes/1/locations" |
|
|
|
|
|
|
|
expect(response).to redirect_to("/account/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data provider" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
post "/schemes/1/locations" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns 401 unauthorized" do |
|
|
|
|
|
|
|
request |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
|
|
|
let(:startdate) { Time.utc(2022, 2, 2) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", startdate:, mobility_type: "A" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
post "/schemes/#{scheme.id}/locations", params: |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
expect(Location.last.startdate).to eq(startdate) |
|
|
|
|
|
|
|
expect(Location.last.mobility_type).to eq("Fitted with equipment and adaptations") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcode is submitted with lower case" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "zz1 1zz", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with postcode " do |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when startdate is submitted with leading zeroes" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "zz1 1zz", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
"startdate(3i)" => "01", |
|
|
|
|
|
|
|
"startdate(2i)" => "01", |
|
|
|
|
|
|
|
"startdate(1i)" => "2022", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with postcode " do |
|
|
|
|
|
|
|
expect(Location.last.startdate).to eq(Time.utc(2022, 1, 1)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when trying to add location to a scheme that belongs to another organisation" do |
|
|
|
|
|
|
|
let(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
post "/schemes/#{another_scheme.id}/locations", params: params |
|
|
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "Yes", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
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.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
expect(Location.last.mobility_type).to eq("None") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as no" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is not selected" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", postcode: "ZZ1 1ZZ", mobility_type: "W" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
expect(Location.last.mobility_type).to eq("Wheelchair-user standard") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required param are missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { postcode: "", name: "Test", units: "", type_of_unit: "", add_another_location: "No" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.units.blank")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.type_of_unit.blank")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.mobility_type.blank")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when invalid time is supplied" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "ZZ1 1ZZ", |
|
|
|
|
|
|
|
"startdate(3i)" => "1", |
|
|
|
|
|
|
|
"startdate(2i)" => "1", |
|
|
|
|
|
|
|
"startdate(1i)" => "w", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.date.invalid_date")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when no startdate is supplied" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "ZZ1 1ZZ", |
|
|
|
|
|
|
|
"startdate(3i)" => "", |
|
|
|
|
|
|
|
"startdate(2i)" => "", |
|
|
|
|
|
|
|
"startdate(1i)" => "", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcodes.io doesn't return a la_code" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "AA1 4AA", |
|
|
|
|
|
|
|
"startdate(3i)" => "", |
|
|
|
|
|
|
|
"startdate(2i)" => "", |
|
|
|
|
|
|
|
"startdate(1i)" => "", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to la_fallback" do |
|
|
|
|
|
|
|
post "/schemes/#{scheme.id}/locations", params: params |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("What is the local authority of AA1 4AA?") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: " Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
post "/schemes/#{scheme.id}/locations", params: |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcode is submitted with lower case" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "zz1 1zz", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with postcode " do |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required postcode param is missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
post "/schemes/#{scheme.id}/locations", params: params |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "Yes", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
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.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as no" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is not selected" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", postcode: "ZZ1 1ZZ", mobility_type: "N" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required param are missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { postcode: "", name: "Test", units: "", type_of_unit: "", add_another_location: "No" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.units.blank")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.type_of_unit.blank")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when invalid time is supplied" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "ZZ1 1ZZ", |
|
|
|
|
|
|
|
"startdate(3i)" => "1", |
|
|
|
|
|
|
|
"startdate(2i)" => "1", |
|
|
|
|
|
|
|
"startdate(1i)" => "w", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.date.invalid_date")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when no startdate is supplied" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "ZZ1 1ZZ", |
|
|
|
|
|
|
|
"startdate(3i)" => "", |
|
|
|
|
|
|
|
"startdate(2i)" => "", |
|
|
|
|
|
|
|
"startdate(1i)" => "", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "creates a new location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1) |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcodes.io doesn't return a la_code" do |
|
|
|
|
|
|
|
let(:params) do |
|
|
|
|
|
|
|
{ location: { |
|
|
|
|
|
|
|
name: "Test", |
|
|
|
|
|
|
|
units: "5", |
|
|
|
|
|
|
|
type_of_unit: "Bungalow", |
|
|
|
|
|
|
|
mobility_type: "N", |
|
|
|
|
|
|
|
add_another_location: "No", |
|
|
|
|
|
|
|
postcode: "AA1 4AA", |
|
|
|
|
|
|
|
"startdate(3i)" => "", |
|
|
|
|
|
|
|
"startdate(2i)" => "", |
|
|
|
|
|
|
|
"startdate(1i)" => "", |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to la_fallback" do |
|
|
|
|
|
|
|
post "/schemes/#{scheme.id}/locations", params: params |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("What is the local authority of AA1 4AA?") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#edit" do |
|
|
|
describe "#edit" do |
|
|
|
context "when not signed in" do |
|
|
|
context "when not signed in" do |
|
|
|
it "redirects to the sign in page" do |
|
|
|
it "redirects to the sign in page" do |
|
|
|
@ -544,286 +146,6 @@ RSpec.describe LocationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#update" do |
|
|
|
|
|
|
|
context "when not signed in" do |
|
|
|
|
|
|
|
it "redirects to the sign in page" do |
|
|
|
|
|
|
|
patch "/schemes/1/locations/1" |
|
|
|
|
|
|
|
expect(response).to redirect_to("/account/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data provider" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
patch "/schemes/1/locations/1" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns 401 unauthorized" do |
|
|
|
|
|
|
|
request |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
|
|
|
let!(:location) { FactoryBot.create(:location, scheme:) } |
|
|
|
|
|
|
|
let(:startdate) { Time.utc(2021, 1, 2) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", startdate:, page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
patch "/schemes/#{scheme.id}/locations/#{location.id}", params: |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
expect(Location.last.startdate).to eq(startdate) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when updating from edit-name page" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", page: "edit-name" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Test") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcode is submitted with lower case" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "zz1 1zz", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with postcode " do |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when trying to update location for a scheme that belongs to another organisation" do |
|
|
|
|
|
|
|
let(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
let(:another_location) { FactoryBot.create(:location) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
patch "/schemes/#{another_scheme.id}/locations/#{another_location.id}", params: params |
|
|
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required postcode param is invalid" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "invalid", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "Yes", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Add a location to this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as no" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is not selected" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.scheme.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required param are missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { postcode: "", name: "Test", units: "", type_of_unit: "", add_another_location: "No" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.units.blank")) |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
|
|
|
let!(:location) { FactoryBot.create(:location, scheme:) } |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
patch "/schemes/#{scheme.id}/locations/#{location.id}", params: |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates a location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your answers before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when updating from edit-name page" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", page: "edit-name" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Test") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when postcode is submitted with lower case" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "zz1 1zz", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates a location for scheme with postcode " do |
|
|
|
|
|
|
|
expect(Location.last.postcode).to eq("ZZ1 1ZZ") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required postcode param is missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "invalid", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as yes" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "Yes", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Add a location to this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is selected as no" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", add_another_location: "No", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates a location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates existing location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when do you want to add another location is not selected" do |
|
|
|
|
|
|
|
let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", postcode: "ZZ1 1ZZ", page: "edit" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates a location for scheme with valid params and redirects to correct page" do |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
|
|
|
expect(page).to have_content("Check your changes before creating this scheme") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "updates a location for scheme with valid params" do |
|
|
|
|
|
|
|
expect(Location.last.name).to eq("Test") |
|
|
|
|
|
|
|
expect(Location.last.units).to eq(5) |
|
|
|
|
|
|
|
expect(Location.last.type_of_unit).to eq("Bungalow") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when required param are missing" do |
|
|
|
|
|
|
|
let(:params) { { location: { postcode: "", name: "Test", units: "", type_of_unit: "", add_another_location: "No" } } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("validations.postcode")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.units.blank")) |
|
|
|
|
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.location.attributes.type_of_unit.blank")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#index" do |
|
|
|
describe "#index" do |
|
|
|
context "when not signed in" do |
|
|
|
context "when not signed in" do |
|
|
|
it "redirects to the sign in page" do |
|
|
|
it "redirects to the sign in page" do |
|
|
|
|