From d1f581ff410ba5c42d03e2cf98efa548a6139b01 Mon Sep 17 00:00:00 2001 From: Izaak Alpert Date: Fri, 14 Jun 2013 10:48:12 -0400 Subject: [PATCH] Fixed an issue with access level var in add team project GITLAB-698 (GITLAB-116) --- lib/gitlab/client/user_teams.rb | 6 ++-- spec/gitlab/client/user_teams_spec.rb | 47 ++++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/lib/gitlab/client/user_teams.rb b/lib/gitlab/client/user_teams.rb index da2368fcc..bd305582a 100644 --- a/lib/gitlab/client/user_teams.rb +++ b/lib/gitlab/client/user_teams.rb @@ -29,7 +29,7 @@ def user_team(team_id) # @param [String] (required) - new user team internal name # @return [Gitlab::ObjectifiedHash] Information about created user. def create_user_team(name, path) - post("/user_teams", :body => {:name => name, :path=> path}) + post("/user_teams", :body => {:name => name, :path => path}) end # Get a list of project team members. If user id is specified get a specific user @@ -91,10 +91,10 @@ def user_teams_projects(team_id, project_id = nil) # # @param [Integer] (required) The ID of a user team # @param [Integer] (required) The ID of a project to add - # @param [Integer] (required) greatest_access_level (required) - Maximum project access level + # @param [Integer] (required) - Maximum project access level # @return [Array] Information about added team project. def add_team_project(team_id, project_id, access_level) - post("/user_teams/#{team_id}/projects", :body => {:project_id => project_id, :access_level => access_level}) + post("/user_teams/#{team_id}/projects", :body => {:project_id => project_id, :greatest_access_level => access_level}) end # Remove user team project diff --git a/spec/gitlab/client/user_teams_spec.rb b/spec/gitlab/client/user_teams_spec.rb index 48419db5b..d4d178691 100644 --- a/spec/gitlab/client/user_teams_spec.rb +++ b/spec/gitlab/client/user_teams_spec.rb @@ -50,34 +50,35 @@ end - describe ".team_members" do - before do - stub_get("/user_teams/3/members", "user_team_members") - @team_members = Gitlab.user_team_members(3) - end - - it "should get the correct resource" do - a_get("/user_teams/3/members").should have_been_made - end + describe ".user_team_members" do + context "when with no specific member" do + before do + stub_get("/user_teams/3/members", "user_team_members") + @team_members = Gitlab.user_team_members(3) + end - it "should return an array of team members" do - @team_members.should be_an Array - @team_members.first.name.should == "John Smith" - end - end + it "should get the correct resource" do + a_get("/user_teams/3/members").should have_been_made + end - describe ".user_team_members" do - before do - stub_get("/user_teams/3/members/1", "user_team_member") - @team_members = Gitlab.user_team_members(3, 1) + it "should return an array of team members" do + @team_members.should be_an Array + @team_members.first.name.should == "John Smith" + end end + context "when passed a particular member" do + before do + stub_get("/user_teams/3/members/1", "user_team_member") + @team_members = Gitlab.user_team_members(3, 1) + end - it "should get the correct resource" do - a_get("/user_teams/3/members/1").should have_been_made - end + it "should get the correct resource" do + a_get("/user_teams/3/members/1").should have_been_made + end - it "should return information about a team member" do - @team_members.name.should == "John Smith" + it "should return information about a team member" do + @team_members.name.should == "John Smith" + end end end