Sha256: 0c8ec7d391cc02d7e41bcd46e796c8b7e99d0fc82b9360494c1b564f9d360398
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' require 'fixtures/models' module CanTango::Ability::Mode class NoCache def calculate_rules # puts "write Post" 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 using option' do subject do CanTango::Ability::Executor::Modal.new @ability, :modes => [:no_cache] end specify { subject.should respond_to :can? } specify { subject.can?(:write, Post).should be_true } end context 'Set execution mode to :no_cache' do subject do CanTango::Ability::Executor::Modal.new @ability, :no_cache end specify { subject.should respond_to :can? } specify { subject.should respond_to :cannot? } describe 'rules should have been calculated' do specify { subject.rules.should_not be_empty } specify { subject.rules.size.should == 1 } specify { subject.rules.first.should be_a CanCan::Rule } specify { subject.can?(:write, Post).should be_true } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-core-0.1.7 | spec/cantango/ability/executor/modal_spec.rb |