Sha256: 424bde98fc1fabc5ca8511bfaf87badaaffd1e61ee5642e7e98acf2c59e6fdd9

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'fixtures/models'

describe CanTango::Engine do
  before do
    @user = User.new 'admin', 'admin@mail.ru'
    @ability = CanTango::Ability::Base.new @user
  end
  
  context '#initilize with ability' do    
    subject { CanTango::Engine.new @ability }
    
    specify { subject.should be_a CanTango::Engine }
    
    specify do
      lambda { subject.execute! }.should raise_error
    end

    specify do
      lambda { subject.engine_name }.should raise_error
    end

    specify do
      subject.modes.should be_empty
    end
    
    specify do
      subject.valid_mode?(:no_cache).should be_false
    end
  end
  
  context '#initilize with ability and :no_cache mode' do
    subject { CanTango::Engine.new @ability, :modes => [:no_cache] }

    specify do
      subject.modes.should_not be_empty
    end

    specify do
      subject.modes.should include(:no_cache)
    end
    
    specify do
      subject.valid_mode?(:no_cache).should be_true
    end

    specify do
      subject.valid_mode?(:cache).should be_false
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cantango-core-0.1.9.3 spec/cantango/engine_spec.rb
cantango-core-0.1.9.2 spec/cantango/engine_spec.rb
cantango-core-0.1.9.1 spec/cantango/engine_spec.rb
cantango-core-0.1.9 spec/cantango/engine_spec.rb
cantango-core-0.1.8 spec/cantango/engine_spec.rb
cantango-core-0.1.7 spec/cantango/engine_spec.rb
cantango-core-0.1.6 spec/cantango/engine_spec.rb
cantango-core-0.1.5 spec/cantango/engine_spec.rb
cantango-core-0.1.4 spec/cantango/engine_spec.rb
cantango-core-0.1.3 spec/cantango/engine_spec.rb