diff options
| author | hukl <contact@smyck.org> | 2009-03-02 20:29:25 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-03 19:47:18 +0100 |
| commit | 82f16e71d49350c1ad4aa48773db5d0f45a55c6c (patch) | |
| tree | 72a341b68e2b1f35772e11add0bef7208e9b90b6 /test/functional | |
| parent | c9183349c2fbacf24fca5cd7767190d069ce8873 (diff) | |
introducing page templates - need to add edit capabilities
renamed the custom template folder
forgot one fix for the new custom template path
page templates refined
renamed page attribute template to template_name as i suspected it to be a reserved word. it still didn't work until i discovered that simon defined the accessible attributes! That costed me 40 minutes of lifetime. But he apologized ;)
tests for public and custom page templates
Diffstat (limited to 'test/functional')
| -rw-r--r-- | test/functional/content_controller_test.rb | 22 | ||||
| -rw-r--r-- | test/functional/nodes_controller_test.rb | 20 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb index c374a83..2f390c6 100644 --- a/test/functional/content_controller_test.rb +++ b/test/functional/content_controller_test.rb | |||
| @@ -67,7 +67,29 @@ class ContentControllerTest < ActionController::TestCase | |||
| 67 | assert_select(".sidebar_headline", "two") | 67 | assert_select(".sidebar_headline", "two") |
| 68 | end | 68 | end |
| 69 | 69 | ||
| 70 | def test_nonexistant_custom_template_defaults_to_standard_template | ||
| 71 | new_node = create_node_under_root "fnord" | ||
| 72 | draft = new_node.find_or_create_draft @user1 | ||
| 73 | draft.template_name = "huchibu" | ||
| 74 | draft.save | ||
| 75 | new_node.publish_draft! | ||
| 76 | |||
| 77 | get :render_page, :locale => 'de', :page_path => ["fnord"] | ||
| 78 | assert_response :success | ||
| 79 | assert_template "custom/page_templates/public/render_page.html.erb" | ||
| 80 | end | ||
| 70 | 81 | ||
| 82 | def test_custom_template_no_date_and_author | ||
| 83 | new_node = create_node_under_root "fnord" | ||
| 84 | draft = new_node.find_or_create_draft @user1 | ||
| 85 | draft.template_name = "no_date_and_author" | ||
| 86 | draft.save | ||
| 87 | new_node.publish_draft! | ||
| 88 | |||
| 89 | get :render_page, :locale => 'de', :page_path => ["fnord"] | ||
| 90 | assert_response :success | ||
| 91 | assert_template "custom/page_templates/public/no_date_and_author.html.erb" | ||
| 92 | end | ||
| 71 | 93 | ||
| 72 | protected | 94 | protected |
| 73 | 95 | ||
diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 20090d0..fdeb6cb 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb | |||
| @@ -56,4 +56,24 @@ class NodesControllerTest < ActionController::TestCase | |||
| 56 | assert_equal "Hello", test_node.draft.title | 56 | assert_equal "Hello", test_node.draft.title |
| 57 | assert_equal "There", test_node.draft.body | 57 | assert_equal "There", test_node.draft.body |
| 58 | end | 58 | end |
| 59 | |||
| 60 | def test_update_a_draft_with_changing_the_template | ||
| 61 | test_node = Node.create! :slug => "test_node" | ||
| 62 | test_node.move_to_child_of Node.root | ||
| 63 | |||
| 64 | login_as :quentin | ||
| 65 | put :update, { | ||
| 66 | :id => test_node.id, | ||
| 67 | :page => { | ||
| 68 | :title => "Hello", | ||
| 69 | :body => "There", | ||
| 70 | :template_name => "Foobar" | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | test_node.reload | ||
| 75 | assert_equal "Hello", test_node.draft.title | ||
| 76 | assert_equal "There", test_node.draft.body | ||
| 77 | assert_equal "Foobar", test_node.draft.template_name | ||
| 78 | end | ||
| 59 | end | 79 | end |
