Skip to content

Commit

Permalink
Split up spec. [#54]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Aug 8, 2013
1 parent faf0e09 commit c1a5a68
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions spec/models/event_spec.rb
Expand Up @@ -109,13 +109,19 @@
event.allow?(:delete).should == true
end

it "should return true for :edit iff current user has a role of admin for the event's calendar or created the event" do
nonadmin = FactoryGirl.create :user, permissions: [FactoryGirl.create(:permission, calendar: event.calendar)]
event.created_by = nonadmin
User.stub current_user: nonadmin
event.allow?(:edit).should == true
User.stub current_user: admin
event.allow?(:edit).should == true
describe 'edit' do
let(:nonadmin) { FactoryGirl.create :user, permissions: [FactoryGirl.create(:permission, calendar: event.calendar)] }

before(:each) { event.created_by = nonadmin }
after(:each) { event.allow?(:edit).should == true }

it "should return true if current user has a role of admin for the event's calendar" do
User.stub current_user: admin
end

it 'should return true if current user created the event' do
User.stub current_user: nonadmin
end
end

it "should return true for :show iff current user has any role for the event's calendar" do
Expand Down

0 comments on commit c1a5a68

Please sign in to comment.