travis-api/spec/lib/model/permission_spec.rb
Aakriti Gupta 65f1a29d86 Move travis-core files from /vendor to /lib.
- Re-factor
- Remove code for notifications
- Remove addons
- Remove travis-core gem.
- Ignore logs directory only
- Move core tests to spec/lib
2016-07-20 11:22:25 +02:00

20 lines
527 B
Ruby

describe Permission do
describe 'by_roles' do
before :each do
Permission::ROLES.each { |role| Permission.create!(role => true) }
end
it 'returns matching permissions if two roles given as symbols' do
Permission.by_roles([:admin, :pull]).size.should == 2
end
it 'returns a single permission if one role given' do
Permission.by_roles('admin').size.should == 1
end
it 'returns an empty scope if no roles given' do
Permission.by_roles('').size.should == 0
end
end
end