Skip to content

Instantly share code, notes, and snippets.

@pcmantz
Created October 26, 2012 16:58
Show Gist options
  • Save pcmantz/3959907 to your computer and use it in GitHub Desktop.
Save pcmantz/3959907 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'cantango/rspec/matchers'
describe GuestRolePermit do
context 'a guest user' do
subject(:guest_user) { FactoryGirl.create(:guest_user) }
context 'acting on a public bundle' do
let(:public_bundle) { FactoryGirl.create(:public_bundle) }
it { should be_allowed_to :read, public_bundle }
[:create, :update, :destroy].each do |action|
it { should_not be_allowed_to action, public_bundle }
end
end
context 'acting on a non-public bundle' do
let(:private_bundle) { FactoryGirl.create(:bundle, public_at: nil) }
[:create, :read, :update, :destroy].each do |action|
it { should_not be_allowed_to action, private_bundle }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment