Browse Source

using blank

pull/760/head
JG 3 years ago
parent
commit
032d0ff4ef
  1. 2
      app/controllers/locations_controller.rb
  2. 21
      spec/requests/locations_controller_spec.rb

2
app/controllers/locations_controller.rb

@ -58,7 +58,7 @@ private
end
def date_params_missing?(location_params)
location_params["startdate(1i)"].empty? && location_params["startdate(2i)"].empty? && location_params["startdate(3i)"].empty?
location_params["startdate(1i)"].blank? && location_params["startdate(2i)"].blank? && location_params["startdate(3i)"].blank?
end
def is_integer?(string)

21
spec/requests/locations_controller_spec.rb

@ -222,27 +222,6 @@ RSpec.describe LocationsController, type: :request do
end
end
context "when invalid time is supplied" do
let(:params) do
{ location: {
name: "Test",
units: "5",
type_of_unit: "Bungalow",
wheelchair_adaptation: "No",
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: {

Loading…
Cancel
Save