Sha256: 0c64e88508b0da9c82dbfe6c77b0ba8322d5351a2a821562aae83bb087d850c6

Contents?: true

Size: 1 KB

Versions: 25

Compression:

Stored size: 1 KB

Contents

require 'rails_helper'

describe ActiveAdmin::Views::Pages::Show do

  describe "the resource" do
    let(:helpers) { double resource: resource }
    let(:arbre_context) { Arbre::Context.new({}, helpers) }
    subject(:page) { ActiveAdmin::Views::Pages::Show.new(arbre_context) }

    context 'when the resource does not respond to #decorator' do
      let(:resource) { 'Test Resource' }

      it "normally returns the resource" do
        expect(page.resource).to eq 'Test Resource'
      end
    end

    context 'when you pass a block to main content' do
      let(:block) { lambda { } }
      let(:resource_class) { double(columns: [double('column', name: 'field')]) }
      let(:resource) { double('resource', class: resource_class) }

      before { allow(page).to receive(:active_admin_config).and_return(double(comments?: false))}

      it 'appends it to the output' do
        expect(page).to receive(:attributes_table).with(:field).and_yield
        page.default_main_content(&block)
      end
    end

  end

end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/show_spec.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.17.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.16.pre spec/unit/views/pages/show_spec.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/show_spec.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/show_spec.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.15.pre spec/unit/views/pages/show_spec.rb
activeadmin-orac-1.0.0.pre4 spec/unit/views/pages/show_spec.rb
activeadmin-orac-1.0.0 spec/unit/views/pages/show_spec.rb
activeadmin-orac-1.0.0.pre.orac spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.14.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.13.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.12.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/views/pages/show_spec.rb
activeadmin-1.0.0.pre4 spec/unit/views/pages/show_spec.rb
activeadmin-1.0.0.pre3 spec/unit/views/pages/show_spec.rb