summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index f0a6012d0c2..4dd2048ccad 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -148,6 +148,23 @@ describe User do
it { @user.owned_groups.should == [@group] }
end
+ describe 'teams' do
+ before do
+ ActiveRecord::Base.observers.enable(:user_observer)
+ @admin = create :user, admin: true
+ @user1 = create :user
+ @user2 = create :user
+ @team = create :user_team, owner: @user1
+ end
+
+ it { @admin.authorized_teams.should == [@team] }
+ it { @user1.authorized_teams.should == [@team] }
+ it { @user2.authorized_teams.should be_empty }
+ it { @admin.should be_can(:manage_user_team, @team) }
+ it { @user1.should be_can(:manage_user_team, @team) }
+ it { @user2.should_not be_can(:manage_user_team, @team) }
+ end
+
describe 'namespaced' do
before do
ActiveRecord::Base.observers.enable(:user_observer)