|
|
|
|
@ -1249,7 +1249,7 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with default date" do |
|
|
|
|
let(:params) { { location: { deactivation_date: } } } |
|
|
|
|
let(:params) { { location: { deactivation_date_type: 1 } } } |
|
|
|
|
|
|
|
|
|
it "renders the confirmation page" do |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
@ -1288,8 +1288,8 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when invalid date is entered" do |
|
|
|
|
let(:params) { { location: { "deactivation_date": "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "44", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
let(:params) { { location: { deactivation_date_type: 2, "deactivation_date(3i)": "10", "deactivation_date(2i)": "44", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
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.location.deactivation_date.invalid")) |
|
|
|
|
@ -1297,8 +1297,8 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the date is entered is before the beginning of current collection window" do |
|
|
|
|
let(:params) { { location: { "deactivation_date": "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "4", "deactivation_date(1i)": "2020" } } } |
|
|
|
|
|
|
|
|
|
let(:params) { { location: { deactivation_date_type: 2, "deactivation_date(3i)": "10", "deactivation_date(2i)": "4", "deactivation_date(1i)": "2020" } } } |
|
|
|
|
|
|
|
|
|
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.location.deactivation_date.out_of_range", date: "5 April 2022")) |
|
|
|
|
@ -1306,8 +1306,8 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the day is not entered" do |
|
|
|
|
let(:params) { { location: { "deactivation_date": "other", "deactivation_date(3i)": "", "deactivation_date(2i)": "2", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
let(:params) { { location: { deactivation_date_type: 2, "deactivation_date(3i)": "", "deactivation_date(2i)": "2", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
it "displays page with an error message" do |
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
expect(page).to have_content(I18n.t("validations.location.deactivation_date.not_entered", period: "day")) |
|
|
|
|
@ -1315,8 +1315,8 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the month is not entered" do |
|
|
|
|
let(:params) { { location: { "deactivation_date": "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
let(:params) { { location: { deactivation_date_type: 2, "deactivation_date(3i)": "2", "deactivation_date(2i)": "", "deactivation_date(1i)": "2022" } } } |
|
|
|
|
|
|
|
|
|
it "displays page with an error message" do |
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
expect(page).to have_content(I18n.t("validations.location.deactivation_date.not_entered", period: "month")) |
|
|
|
|
@ -1324,8 +1324,8 @@ RSpec.describe LocationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the year is not entered" do |
|
|
|
|
let(:params) { { location: { "deactivation_date": "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "2", "deactivation_date(1i)": "" } } } |
|
|
|
|
|
|
|
|
|
let(:params) { { location: { deactivation_date_type: 2, "deactivation_date(3i)": "2", "deactivation_date(2i)": "2", "deactivation_date(1i)": "" } } } |
|
|
|
|
|
|
|
|
|
it "displays page with an error message" do |
|
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
|
expect(page).to have_content(I18n.t("validations.location.deactivation_date.not_entered", period: "year")) |
|
|
|
|
|