Sha256: e93588a4e0787456ffa12b7c469636410c7826cb381c1afbde7a4cf813a3be86

Contents?: true

Size: 895 Bytes

Versions: 20

Compression:

Stored size: 895 Bytes

Contents

require 'rails_helper'

RSpec.describe ActiveAdmin::ResourceController::Sidebars, type: :controller do
  let(:klass){ Admin::PostsController }

  shared_context 'with post config' do
    before do
      load_resources { post_config }

      @controller = klass.new

      get :index
    end
  end

  context 'without skip_sidebar! before filter' do
    include_context 'with post config' do
      let(:post_config) { ActiveAdmin.register Post }
    end

    it 'does not set @skip_sidebar' do
      expect(controller.instance_variable_get(:@skip_sidebar)).to eq nil
    end
  end

  context 'with skip_sidebar! before_action' do
    include_context 'with post config' do
      let(:post_config) do
        ActiveAdmin.register(Post) { before_action :skip_sidebar! }
      end
    end

    it 'works' do
      expect(controller.instance_variable_get(:@skip_sidebar)).to eq true
    end
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
activeadmin-rails-1.7.1 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rails-1.7.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rb-1.6.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rb-1.5.2 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rb-1.5.1 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rb-1.5.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin-rb-1.4.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.3.1 spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.3.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.2.1 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.2.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.1.0 spec/unit/resource_controller/sidebars_spec.rb
activeadmin-1.0.0 spec/unit/resource_controller/sidebars_spec.rb