Skip to content

Instantly share code, notes, and snippets.

@benaskins
Created November 10, 2008 02:10
Show Gist options
  • Save benaskins/23405 to your computer and use it in GitHub Desktop.
Save benaskins/23405 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../spec_helper'
Machinist::load_blueprint :user
describe User do
describe 'Adam Administrator' do
before do
@adam = User.make(:role => "Administrator")
end
it 'can create administrators' do
@adam.can_create_user_with_role?("Administrator").should be_true
end
it 'can create site creators' do
@adam.can_create_user_with_role?("Site Creator").should be_true
end
it 'can create content editors' do
@adam.can_create_user_with_role?("Content Editor").should be_true
end
end
describe 'Sally Site Creator' do
before do
@adam = User.make(:role => "Site Creator")
end
it 'can not create administrators' do
@adam.can_create_user_with_role?("Administrator").should_not be_true
end
it 'can create site creators' do
@adam.can_create_user_with_role?("Site Creator").should be_true
end
it 'can create content editors' do
@adam.can_create_user_with_role?("Content Editor").should be_true
end
end
describe 'Eddy Content Editor' do
before do
@adam = User.make(:role => "Content Editor")
end
it 'can not create administrators' do
@adam.can_create_user_with_role?("Administrator").should_not be_true
end
it 'can not create site creators' do
@adam.can_create_user_with_role?("Site Creator").should_not be_true
end
it 'can create content editors' do
@adam.can_create_user_with_role?("Content Editor").should be_true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment