Browse Source

test: test for actual validation string, not the validation lookup

pull/1027/head
Sam Seed 4 years ago
parent
commit
dff9e16303
  1. 2
      spec/models/scheme_spec.rb
  2. 2
      spec/requests/schemes_controller_spec.rb

2
spec/models/scheme_spec.rb

@ -217,7 +217,7 @@ RSpec.describe Scheme, type: :model do
context "when the owning organisation is set as a non-stock-owning organisation" do
it "throws the correct validation error" do
expect { scheme.update!({ owning_organisation_id: non_stock_owning_org.id }) }.to raise_error(ActiveRecord::RecordInvalid, /#{I18n.t("validations.scheme.owning_organisation.does_not_own_stock")}/)
expect { scheme.update!({ owning_organisation_id: non_stock_owning_org.id }) }.to raise_error(ActiveRecord::RecordInvalid, /Enter an organisation that owns housing stock/)
end
end
end

2
spec/requests/schemes_controller_spec.rb

@ -611,7 +611,7 @@ RSpec.describe SchemesController, type: :request do
it "displays the new page with an error message" do
post "/schemes", params: params
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.owning_organisation.does_not_own_stock"))
expect(page).to have_content("Enter an organisation that owns housing stock")
end
end
end

Loading…
Cancel
Save