From c8c632fe01bc232d38a921d56f8f2a557ed74817 Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 20 Jul 2022 08:49:28 +0100 Subject: [PATCH] testing for invalid startdate --- spec/requests/locations_controller_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index 2148f350d..f4b0b6840 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -200,6 +200,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 invalid time is supplied" do + let(:params) { { location: { "startdate(3i)" => "1", "startdate(2i)" => "1", "startdate(1i)" => "w" } } } + + 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 end context "when signed in as a support user" do