Sha256: e0501981fe0445151f25784b418d2943e4f1d75fa6e32da3f224cf8659b011a7

Contents?: true

Size: 873 Bytes

Versions: 16

Compression:

Stored size: 873 Bytes

Contents

require 'active_record/spec_helper'
require_all File.dirname(__FILE__) + "/../../shared/"

def preconfigure
  CanTango.configure do |config|
    config.permit_engine.set :on
    config.permission_engine.set :off
  end
end

describe 'RoleGroupPermit usage' do
  before(:each) {
    preconfigure
    @user = User.create!(:email => "kris@gmail.com", :role_groups_list => [:musicians])
  }

  let(:current_user) { @user }
  let(:ability) { current_ability(:user) }

  it "should be allowed to read Song" do
    ability.should be_allowed_to(:read, Song)
  end
  
  it "should be allowed to write Tune" do
    ability.should be_allowed_to(:write, Tune)
  end

  it "should be allowed to manage Concerto" do
    ability.should be_allowed_to(:read, Concerto)
  end
  
  it "should be allowed to write Tune" do
    ability.should_not be_allowed_to(:manage, Improvisation)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cantango-0.9.4.1 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.9.4 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.9.3.2 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9.5 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9.4 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9.3 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9.2 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9.1 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.9 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.8.1 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.8 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.7 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.6.2 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.6.1 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.6 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb
cantango-0.8.5.1 spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb