home_controller_test.rb
1.87 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require File.dirname(__FILE__) + '/../test_helper'
require 'home_controller'
# Re-raise errors caught by the controller.
class HomeController; def rescue_action(e) raise e end; end
class HomeControllerTest < Test::Unit::TestCase
# all_fixtures:profiles, :environments, :domains
all_fixtures
def setup
@controller = HomeController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_local_files_reference
assert_local_files_reference
end
def test_valid_xhtml
assert_valid_xhtml
end
should 'not display news from portal if disabled in environment' do
env = Environment.default
env.disable('use_portal_community')
env.save!
get :index
assert_no_tag :tag => 'div', :attributes => { :id => 'portal-news' }
end
should 'not display news from portal if environment doesnt have portal community' do
env = Environment.default
env.enable('use_portal_community')
env.save!
get :index
assert_no_tag :tag => 'div', :attributes => { :id => 'portal-news' }
end
should 'display news from portal if enabled and has portal community' do
env = Environment.default
env.enable('use_portal_community')
c = Community.create!(:name => 'community test')
env.portal_community = c
env.save!
get :index
assert_tag :tag => 'div', :attributes => { :id => 'portal-news' } #, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}}
end
should 'display block in index page if it\'s configured to display on homepage and its an environment block' do
env = Environment.default
box = Box.create(:owner_type => 'Environment', :owner_id => env.id)
block = Block.create(:title => "Index Block", :box_id => box.id, :display => 'home_page_only')
env.save!
get :index
assert block.visible?
end
end