fix mass-assignment error in user create API
This commit is contained in:
parent
770ec3359d
commit
c610206321
|
@ -40,7 +40,7 @@ module Gitlab
|
|||
post do
|
||||
authenticated_as_admin!
|
||||
attrs = attributes_for_keys [:email, :name, :password, :password_confirmation, :skype, :linkedin, :twitter, :projects_limit]
|
||||
user = User.new attrs
|
||||
user = User.new attrs, as: :admin
|
||||
if user.save
|
||||
present user, with: Entities::User
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@ describe Gitlab::API do
|
|||
|
||||
it "should create user" do
|
||||
expect {
|
||||
post api("/users", admin), Factory.attributes(:user)
|
||||
post api("/users", admin), Factory.attributes(:user, projects_limit: 3)
|
||||
}.to change { User.count }.by(1)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue