Sha256: 0a2dd7da57e7c466b464c0ec3258a6143d9515860e15574a31d239c4b04ba4d0

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

module CanTango::Ability::Mode
  class NoCache
    def calculate_rules
      can :write, Post
    end
  end
end

describe CanTango::Ability::Executor::Modal do
  before do
    @user = User.new 'admin', 'admin@mail.ru'
    @ability = CanTango::Ability::Base.new @user
  end

  context 'Set execution mode to :no_cache' do
    subject do 
      CanTango::Ability::Executor::Modal.new @ability, :no_cache
    end

    its(:rules)  { should be_empty }

    describe 'rules should be calculated on execute' 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 }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cantango-core-0.1.5 spec/cantango/ability/executor/modal_spec.rb
cantango-core-0.1.4 spec/cantango/ability/executor/modal_spec.rb