cms_controller_test.rb
1.26 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
require File.dirname(__FILE__) + '/../test_helper'
require 'cms_controller'
# Re-raise errors caught by the controller.
class CmsController; def rescue_action(e) raise e end; end
class CmsControllerTest < Test::Unit::TestCase
fixtures :environments
def setup
@controller = CmsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@profile = create_user('testinguser').person
end
attr_reader :profile
should 'list top level documents on index' do
get :index, :profile => profile.identifier
assert_template 'view'
assert_equal profile, assigns(:profile)
assert_nil assigns(:article)
assert_kind_of Array, assigns(:subitems)
end
should 'be able to view a particular document' do
a = profile.articles.build(:name => 'blablabla')
a.save!
get :view, :profile => profile.identifier, :id => a.id
assert_template 'view'
assert_equal a, assigns(:article)
assert_equal [], assigns(:subitems)
assert_kind_of Array, assigns(:subitems)
end
should 'be able to edit a document' do
flunk 'not yet'
end
should 'be able to save a save a document' do
flunk 'not yet'
end
should 'be able to set home page' do
flunk 'pending'
end
end