Skip to content

Commit 4f7d4b7

Browse files
coffeejunkstas
authored andcommitted
Expect different blank validation detail Rails 6.1
Due to the change in b019536 the validation error message for a required field changes from "$x can't be blank" to "$x must exist".
1 parent 870a7f0 commit 4f7d4b7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spec/errors_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@
5656
.to eq(Rack::Utils::HTTP_STATUS_CODES[422])
5757
expect(response_json['errors'][0]['source'])
5858
.to eq('pointer' => '/data/relationships/user')
59-
expect(response_json['errors'][0]['detail'])
60-
.to eq('User can\'t be blank')
59+
if Rails::VERSION::MAJOR >= 6 && Rails::VERSION::MINOR >= 1
60+
expect(response_json['errors'][0]['detail'])
61+
.to eq('User must exist')
62+
else
63+
expect(response_json['errors'][0]['detail'])
64+
.to eq('User can\'t be blank')
65+
end
6166
end
6267

6368
context 'required by validations' do

0 commit comments

Comments
 (0)