Commit 5b657a65d4ec309be2cb7dfcacf85e98d59a4eb0
1 parent
479631aa
Exists in
master
and in
4 other branches
Added test cases to verify admin status of users created via API.
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
spec/requests/api/users_spec.rb
... | ... | @@ -62,6 +62,25 @@ describe API::API do |
62 | 62 | new_user.can_create_group.should == true |
63 | 63 | end |
64 | 64 | |
65 | + it "should create non-admin user" do | |
66 | + post api('/users', admin), attributes_for(:user, admin: false, can_create_group: false) | |
67 | + response.status.should == 201 | |
68 | + user_id = json_response['id'] | |
69 | + new_user = User.find(user_id) | |
70 | + new_user.should_not == nil | |
71 | + new_user.admin.should == false | |
72 | + new_user.can_create_group.should == false | |
73 | + end | |
74 | + | |
75 | + it "should create non-admin users by default" do | |
76 | + post api('/users', admin), attributes_for(:user) | |
77 | + response.status.should == 201 | |
78 | + user_id = json_response['id'] | |
79 | + new_user = User.find(user_id) | |
80 | + new_user.should_not == nil | |
81 | + new_user.admin.should == false | |
82 | + end | |
83 | + | |
65 | 84 | it "should return 201 Created on success" do |
66 | 85 | post api("/users", admin), attributes_for(:user, projects_limit: 3) |
67 | 86 | response.status.should == 201 | ... | ... |