profile_design_controller_test.rb
1.83 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require File.dirname(__FILE__) + '/../test_helper'
class ProfileDesignController
append_view_path File.join(File.dirname(__FILE__) + '/../../views')
def rescue_action(e)
raise e
end
end
class ProfileDesignControllerTest < ActionController::TestCase
def setup
@environment = Environment.default
@environment.enabled_plugins = ['BreadcrumbsPlugin']
@environment.save!
@profile = fast_create(Community, :environment_id => @environment.id)
@page = fast_create(Folder, :profile_id => @profile.id)
box = create(Box, :owner => @profile)
@block = create(BreadcrumbsPlugin::ContentBreadcrumbsBlock, :box => box)
user = create_user('testinguser')
@profile.add_admin(user.person)
login_as(user.login)
end
should 'be able to edit breadcrumbs block' do
get :edit, :id => @block.id, :profile => @profile.identifier
assert_tag :tag => 'input', :attributes => { :id => 'block_title' }
assert_tag :tag => 'input', :attributes => { :id => 'block_show_cms_action' }
assert_tag :tag => 'input', :attributes => { :id => 'block_show_profile' }
end
should 'be able to save breadcrumbs block' do
get :edit, :id => @block.id, :profile => @profile.identifier
post :save, :id => @block.id, :profile => @profile.identifier, :block => {:title => 'breadcrumbs', :show_cms_action => false, :show_profile => false}
@block.reload
assert_equal 'breadcrumbs', @block.title
refute @block.show_profile
refute @block.show_cms_action
end
should 'be able save breadcrumbs block with show_section_name option' do
get :edit, :id => @block.id, :profile => @profile.identifier
post :save, :id => @block.id, :profile => @profile.identifier, :block => {:title => 'breadcrumbs', :show_cms_action => false, :show_profile => true, :show_section_name => true }
assert @block.show_section_name
end
end