Sha256: 87276ca4a1ac42f493fb6408354a1916a85a381c481207b3a7ed01deb6f15611

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

require 'rails_helper'

describe ActiveAdmin::Application do
  let(:application){ ActiveAdmin::Application.new }
  let(:controllers){ application.controllers_for_filters }

  it 'controllers_for_filters' do
    expect(application.controllers_for_filters).to eq [
      ActiveAdmin::BaseController, ActiveAdmin::Devise::SessionsController,
      ActiveAdmin::Devise::PasswordsController, ActiveAdmin::Devise::UnlocksController,
      ActiveAdmin::Devise::RegistrationsController, ActiveAdmin::Devise::ConfirmationsController
    ]
  end

  it 'before_filter' do
    controllers.each{ |c| expect(c).to receive(:before_filter).and_return(true) }
    application.before_filter :my_filter, only: :show
  end

  it 'skip_before_filter' do
    controllers.each{ |c| expect(c).to receive(:skip_before_filter).and_return(true) }
    application.skip_before_filter :my_filter, only: :show
  end

  it 'after_filter' do
    controllers.each{ |c| expect(c).to receive(:after_filter).and_return(true) }
    application.after_filter :my_filter, only: :show
  end

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

  it 'around_filter' do
    controllers.each{ |c| expect(c).to receive(:around_filter).and_return(true) }
    application.around_filter :my_filter, only: :show
  end

  it 'skip_filter' do
    controllers.each{ |c| expect(c).to receive(:skip_filter).and_return(true) }
    application.skip_filter :my_filter, only: :show
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
yousty-activeadmin-1.0.12.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/controller_filters_spec.rb
activeadmin-1.0.0.pre1 spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.7.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.6.pre spec/unit/controller_filters_spec.rb
yousty-activeadmin-1.0.5.pre spec/unit/controller_filters_spec.rb