API fixes
Created by: NARKOZ
Merge request reports
Activity
188 188 }.to change {project.hooks.count}.by(1) 189 189 end 190 190 end 191 191 192 192 describe "PUT /projects/:id/hooks/:hook_id" do 193 193 it "should update an existing project hook" do 194 194 put api("/projects/#{project.code}/hooks/#{hook.id}", user), 195 url: 'http://example.com' 195 url: 'http://example.org' 32 31 # password (required) - Password 33 # password_confirmation (required) - Password confirmation 32 # name - Name 34 33 # skype - Skype ID 35 34 # linkedin - Linkedin 36 35 # twitter - Twitter account 37 # projects_limit - Limit projects wich user can create 36 # projects_limit - Number of projects user can create 38 37 # Example Request: 39 38 # POST /users 40 39 post do 41 40 authenticated_as_admin! 42 attrs = attributes_for_keys [:email, :name, :password, :password_confirmation, :skype, :linkedin, :twitter, :projects_limit] 43 user = User.new attrs 41 attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit] 42 user = User.new attrs, as: :admin 23 23 @user = User.find(params[:id]) 24 24 present @user, with: Entities::User 25 25 end 26 26 27 27 # Create user. Available only for admin 28 28 # 29 29 # Parameters: 30 30 # email (required) - Email 31 # name (required) - Name 32 31 # password (required) - Password 33 # password_confirmation (required) - Password confirmation 42 42 end 43 43 44 44 it "should create user" do 45 expect{ 46 post api("/users", admin), Factory.attributes(:user) 47 }.to change{User.count}.by(1) 45 expect { 46 post api("/users", admin), Factory.attributes(:user, projects_limit: 3) 32 31 # password (required) - Password 33 # password_confirmation (required) - Password confirmation 32 # name - Name 34 33 # skype - Skype ID 35 34 # linkedin - Linkedin 36 35 # twitter - Twitter account 37 # projects_limit - Limit projects wich user can create 36 # projects_limit - Number of projects user can create 38 37 # Example Request: 39 38 # POST /users 40 39 post do 41 40 authenticated_as_admin! 42 attrs = attributes_for_keys [:email, :name, :password, :password_confirmation, :skype, :linkedin, :twitter, :projects_limit] 43 user = User.new attrs 41 attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit] 42 user = User.new attrs, as: :admin Created by: NARKOZ
because https://github.com/gitlabhq/gitlabhq/blob/master/app/models/user.rb#L10
By Administrator on 2012-10-19T14:47:04 (imported from GitLab project)
By Administrator on 2012-10-19T14:47:04 (imported from GitLab)
188 188 }.to change {project.hooks.count}.by(1) 189 189 end 190 190 end 191 191 192 192 describe "PUT /projects/:id/hooks/:hook_id" do 193 193 it "should update an existing project hook" do 194 194 put api("/projects/#{project.code}/hooks/#{hook.id}", user), 195 url: 'http://example.com' 195 url: 'http://example.org'
Please register or sign in to reply