Created
March 15, 2016 12:22
-
-
Save hchood/043bb5b9f8ede627285b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /spec/requests/v1/users_requests_spec.rb | |
context 'with errors' do | |
context 'such as a pre-existing email' do | |
it 'returns a 422 response and JSON for errors' do | |
existing_user = create(:user) | |
user_attributes = { | |
user: { | |
email: existing_user.email, | |
password: user.password_digest | |
} | |
}.to_json | |
post(users_url, user_attributes, accept_headers) | |
expect(response).to have_http_status :unprocessable_entity | |
expect(json_value_at_path('errors/0')).to eq 'Email has already been taken' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment