Sha256: 30e243ec910e6cb7826b0719d65e01d426a56c76f56508c172e13486045ecba2

Contents?: true

Size: 694 Bytes

Versions: 4

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

shared_examples_for CanTango::Ability::Mode::Base do
  before do
    @user = User.new 'admin', 'admin@mail.ru'
    @ability = CanTango::Ability::Base.new @user
  end

  subject { mode_class.new @ability }

  describe 'Does NOT execute on instantiation' do      
    specify do
      subject.rules.should == []
    end
  end

  describe 'execute will calculate rules' do
    before do
      subject.execute
    end
    specify { subject.rules.should_not be_empty }
    specify { subject.rules.size.should == 1 }
    specify { subject.rules.first.should be_a CanCan::Rule }
    
    specify { subject.should be_allowed_to(:read, Post) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cantango-core-0.1.7 spec/cantango/ability/mode/base_example.rb
cantango-core-0.1.6 spec/cantango/ability/mode/base_example.rb
cantango-core-0.1.5 spec/cantango/ability/mode/base_example.rb
cantango-core-0.1.4 spec/cantango/ability/mode/base_example.rb