From 82f16e71d49350c1ad4aa48773db5d0f45a55c6c Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Mar 2009 20:29:25 +0100 Subject: 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 --- test/functional/nodes_controller_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/functional/nodes_controller_test.rb') 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 assert_equal "Hello", test_node.draft.title assert_equal "There", test_node.draft.body end + + def test_update_a_draft_with_changing_the_template + test_node = Node.create! :slug => "test_node" + test_node.move_to_child_of Node.root + + login_as :quentin + put :update, { + :id => test_node.id, + :page => { + :title => "Hello", + :body => "There", + :template_name => "Foobar" + } + } + + test_node.reload + assert_equal "Hello", test_node.draft.title + assert_equal "There", test_node.draft.body + assert_equal "Foobar", test_node.draft.template_name + end end -- cgit v1.3