diff options
author | Boyan Tabakov <boyan.tabakov@futurice.com> | 2013-09-29 19:55:09 +0300 |
---|---|---|
committer | Boyan Tabakov <boyan.tabakov@futurice.com> | 2013-09-29 19:55:09 +0300 |
commit | 5b657a65d4ec309be2cb7dfcacf85e98d59a4eb0 (patch) | |
tree | c8176823c0c921a23d90b7ed22a936dd8c3f4625 /spec/requests | |
parent | 479631aafc525efef151309ac257e60c73230ac0 (diff) | |
download | gitlab-ce-5b657a65d4ec309be2cb7dfcacf85e98d59a4eb0.tar.gz |
Added test cases to verify admin status of users created via API.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 4a299d3d958..4ef78b8e5d0 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -62,6 +62,25 @@ describe API::API do new_user.can_create_group.should == true end + it "should create non-admin user" do + post api('/users', admin), attributes_for(:user, admin: false, can_create_group: false) + response.status.should == 201 + user_id = json_response['id'] + new_user = User.find(user_id) + new_user.should_not == nil + new_user.admin.should == false + new_user.can_create_group.should == false + end + + it "should create non-admin users by default" do + post api('/users', admin), attributes_for(:user) + response.status.should == 201 + user_id = json_response['id'] + new_user = User.find(user_id) + new_user.should_not == nil + new_user.admin.should == false + end + it "should return 201 Created on success" do post api("/users", admin), attributes_for(:user, projects_limit: 3) response.status.should == 201 |