Skip to content

Commit

Permalink
Fix add_team_member
Browse files Browse the repository at this point in the history
According to the API document(https://github.com/gitlabhq/gitlabhq/blob/stable/doc/api/projects.md),
add_team_member post url should be "/projects/#{project}/members" and body should
have user_id.So I fixed this method and related specs.
  • Loading branch information
mizzy committed Oct 19, 2012
1 parent 6a0176a commit 5fcf078
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/gitlab/client/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def team_member(project, id)
# @param [Integer] access_level The access level to project.
# @return [Array<Gitlab::ObjectifiedHash>] Information about added team member.
def add_team_member(project, id, access_level)
post("/projects/#{project}/members/#{id}", :body => {:access_level => access_level})
post("/projects/#{project}/members", :body => {:user_id => id, :access_level => access_level})
end

# Updates a team member's project access level.
Expand Down
6 changes: 3 additions & 3 deletions spec/gitlab/client/projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@

describe ".add_team_member" do
before do
stub_post("/projects/3/members/1", "team_member")
stub_post("/projects/3/members", "team_member")
@team_member = Gitlab.add_team_member(3, 1, 40)
end

it "should get the correct resource" do
a_post("/projects/3/members/1").
with(:body => {:access_level => '40'}).should have_been_made
a_post("/projects/3/members").
with(:body => {:user_id => '1', :access_level => '40'}).should have_been_made
end

it "should return information about an added team member" do
Expand Down

0 comments on commit 5fcf078

Please sign in to comment.