Sha256: 39522047d5d08a69a95c9729b1cb541e82ddb458049d667b835b57db25ecc039

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe ActiveAdmin::Application do
  let(:application){ ActiveAdmin::Application.new }
  let(:controllers){ [ActiveAdmin::BaseController,            ActiveAdmin::Devise::SessionsController,
                      ActiveAdmin::Devise::UnlocksController, ActiveAdmin::Devise::PasswordsController] }

  it 'before_filter' do
    controllers.each{ |c| c.should_receive(:before_filter).and_return(true) }
    application.before_filter :my_filter, :only => :show
  end

  it 'skip_before_filter' do
    controllers.each{ |c| c.should_receive(:skip_before_filter).and_return(true) }
    application.skip_before_filter :my_filter, :only => :show
  end

  it 'after_filter' do
    controllers.each{ |c| c.should_receive(:after_filter).and_return(true) }
    application.after_filter :my_filter, :only => :show
  end

  it 'skip after_filter' do
    controllers.each{ |c| c.should_receive(:skip_after_filter).and_return(true) }
    application.skip_after_filter :my_filter, :only => :show
  end

  it 'around_filter' do
    controllers.each{ |c| c.should_receive(:around_filter).and_return(true) }
    application.around_filter :my_filter, :only => :show
  end
  
  it 'skip_filter' do
    controllers.each{ |c| c.should_receive(:skip_filter).and_return(true) }
    application.skip_filter :my_filter, :only => :show
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-0.6.6 spec/unit/controller_filters_spec.rb
activeadmin-0.6.5 spec/unit/controller_filters_spec.rb