Commit 21f7c99c25615961f6eed870b38ba8fba558b879
1 parent
a0640600
Exists in
master
and in
4 other branches
group add_users spec
Showing
1 changed file
with
12 additions
and
1 deletions
Show diff stats
spec/models/group_spec.rb
| @@ -17,7 +17,11 @@ require 'spec_helper' | @@ -17,7 +17,11 @@ require 'spec_helper' | ||
| 17 | describe Group do | 17 | describe Group do |
| 18 | let!(:group) { create(:group) } | 18 | let!(:group) { create(:group) } |
| 19 | 19 | ||
| 20 | - it { should have_many :projects } | 20 | + describe "Associations" do |
| 21 | + it { should have_many :projects } | ||
| 22 | + it { should have_many :users_groups } | ||
| 23 | + end | ||
| 24 | + | ||
| 21 | it { should validate_presence_of :name } | 25 | it { should validate_presence_of :name } |
| 22 | it { should validate_uniqueness_of(:name) } | 26 | it { should validate_uniqueness_of(:name) } |
| 23 | it { should validate_presence_of :path } | 27 | it { should validate_presence_of :path } |
| @@ -31,4 +35,11 @@ describe Group do | @@ -31,4 +35,11 @@ describe Group do | ||
| 31 | describe :human_name do | 35 | describe :human_name do |
| 32 | it { group.human_name.should == group.name } | 36 | it { group.human_name.should == group.name } |
| 33 | end | 37 | end |
| 38 | + | ||
| 39 | + describe :add_users do | ||
| 40 | + let(:user) { create(:user) } | ||
| 41 | + before { group.add_users([user.id], UsersGroup::MASTER) } | ||
| 42 | + | ||
| 43 | + it { group.users_groups.masters.map(&:user).should include(user) } | ||
| 44 | + end | ||
| 34 | end | 45 | end |