diff options
author | Joost Rijneveld <joost@joostrijneveld.nl> | 2017-02-03 17:49:27 +0300 |
---|---|---|
committer | Joost Rijneveld <joost@joostrijneveld.nl> | 2017-02-09 22:32:54 +0300 |
commit | 6fab6d94cef853ed0d081dcea0fbfe390047b1c8 (patch) | |
tree | 4aa62ba92455257e6b8ceeb8779044d9b25bb1d3 /spec/requests/api/users_spec.rb | |
parent | 52ea505126da19717c9137e6bb301f55965eb6e4 (diff) |
Optionally make users created via the API set their password
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r-- | spec/requests/api/users_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 8692f9da976..5958012672e 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -190,6 +190,18 @@ describe API::Users, api: true do expect(new_user.external).to be_truthy end + it "creates user with reset password" do + post api('/users', admin), attributes_for(:user, reset_password: true).except(:password) + + expect(response).to have_http_status(201) + + user_id = json_response['id'] + new_user = User.find(user_id) + + expect(new_user).not_to eq(nil) + expect(new_user.recently_sent_password_reset?).to eq(true) + end + it "does not create user with invalid email" do post api('/users', admin), email: 'invalid email', |