-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
show_spec.rb
33 lines (24 loc) · 1 KB
/
show_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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