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-1.0.0.pre2 spec/unit/views/pages/show_spec.rb
activeadmin-1.0.0.pre1 spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.7.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.6.pre spec/unit/views/pages/show_spec.rb
yousty-activeadmin-1.0.5.pre spec/unit/views/pages/show_spec.rb