summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorChristian Höltje <choltje@us.ibm.com>2013-03-26 10:19:55 -0400
committerChristian Höltje <choltje@us.ibm.com>2013-03-26 10:19:55 -0400
commitb8502cbaeeb843f579221664289f3ff93be3df67 (patch)
tree1a5ca8ccc9796a75a0814f9bd70af1833812aecc /spec
parent58a1ed6dd3090cdcacf01e86a01128e055218c77 (diff)
downloadgitlab-ce-b8502cbaeeb843f579221664289f3ff93be3df67.tar.gz
Fixed UsersProject.in_projects
I discovered while trying to use UserTeam#remove_member() that UsersProject.in_projects was broken. So I wrote test cases to test what I was trying to do and fixed the underlying problem.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_team_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/user_team_spec.rb b/spec/models/user_team_spec.rb
index 6cc2003e97d..d330bbf3e33 100644
--- a/spec/models/user_team_spec.rb
+++ b/spec/models/user_team_spec.rb
@@ -14,5 +14,24 @@
require 'spec_helper'
describe UserTeam do
- pending "add some examples to (or delete) #{__FILE__}"
+ let(:team) { FactoryGirl.create :user_team }
+
+ context ".add_member" do
+ let(:user) { FactoryGirl.create :user }
+
+ it "should work" do
+ team.add_member(user, UsersProject::DEVELOPER, false)
+ team.members.should include(user)
+ end
+ end
+
+ context ".remove_member" do
+ let(:user) { FactoryGirl.create :user }
+ before { team.add_member(user, UsersProject::DEVELOPER, false) }
+
+ it "should work" do
+ team.remove_member(user)
+ team.members.should_not include(user)
+ end
+ end
end