Sha256: 498c693fbba8e3c951883009984c4ce82a51e963a6d782de20d218e8b84783f5

Contents?: true

Size: 1.24 KB

Versions: 21

Compression:

Stored size: 1.24 KB

Contents

require 'dummy_spec_helper'

# Cutter::
Cutter::Stamper.turn :off

describe "Caching of the rules" do

  before(:all) do
    @user = User.create! :name => 'stanislaw', :role => 'user', :email => 'stanislaw@mail.ru'
    Article.create!(:title => 'one')
  end

  context 'CanTango::Ability::Cache::Session::Cache' do
    before do
      CanTango.configure do |config|
        config.cache_engine.store.default_class = CanTango::Ability::Cache::SessionCache
      end
    end

    it "should just response" do
      get root_path
      response.status.should be(200)
    end

    it "should populate session with cache_key" do
      get '/login_user/stanislaw'
      session[:cache_key].should be_nil
      get '/articles'
      session[:cache_key].should_not be_nil
    end

    context "current Ability" do
      it "should have #cached_rules equal to #rules" do
        get '/login_user/stanislaw'
        get '/articles'
        #puts response.body
        response.body.should match(/Cached the rules!/)
        response.body.should match(/Using cached rules: false/)
        get '/articles'
        response.body.should match(/Cached the rules!/)
        response.body.should match(/Using cached rules: true/)
        #puts response.body
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/integration/cache_using_session_spec.rb
cantango-0.9.4.6 spec/integration/cache_using_session_spec.rb
cantango-0.9.4.5 spec/integration/cache_using_session_spec.rb
cantango-0.9.4.3 spec/integration/cache_using_session_spec.rb
cantango-0.9.4.2 spec/integration/cache_using_session_spec.rb
cantango-0.9.4.1 spec/integration/cache_using_session_spec.rb
cantango-0.9.4 spec/integration/cache_using_session_spec.rb
cantango-0.9.3.2 spec/integration/cache_using_session_spec.rb
cantango-0.8.9.5 spec/integration/cache_using_session_spec.rb
cantango-0.8.9.4 spec/integration/cache_using_session_spec.rb
cantango-0.8.9.3 spec/integration/cache_using_session_spec.rb
cantango-0.8.9.2 spec/integration/cache_using_session_spec.rb
cantango-0.8.9.1 spec/integration/cache_using_session_spec.rb
cantango-0.8.9 spec/integration/cache_using_session_spec.rb
cantango-0.8.8.1 spec/integration/cache_using_session_spec.rb
cantango-0.8.8 spec/integration/cache_using_session_spec.rb
cantango-0.8.7 spec/integration/cache_using_session_spec.rb
cantango-0.8.6.2 spec/integration/cache_using_session_spec.rb
cantango-0.8.6.1 spec/integration/cache_using_session_spec.rb
cantango-0.8.6 spec/integration/cache_using_session_spec.rb