Sha256: 884fcfe4fa92116da61028a0438b4f6cdb8d6034c743bf31e7237cc28893dcb8

Contents?: true

Size: 539 Bytes

Versions: 16

Compression:

Stored size: 539 Bytes

Contents

require 'rails_helper'

RSpec.describe 'Index overriding', type: :controller do
  before do
    load_resources { ActiveAdmin.register Post }
    @controller = Admin::PostsController.new

    @controller.instance_eval do
      def index
        super do
          render ActiveAdmin::Dependency.rails.render_key => 'Rendered from passed block'
          return
        end
      end
    end
  end

  it 'should call block passed to overridden index' do
    get :index
    expect(response.body).to eq 'Rendered from passed block'
  end

end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
activeadmin-rb-1.5.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin-rb-1.4.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.3.1 spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.3.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.2.1 spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.2.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.1.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.0.0 spec/unit/authorization/index_overriding_spec.rb
activeadmin-1.0.0.pre5 spec/unit/authorization/index_overriding_spec.rb