From 8afffc09bcaa4d1c77f1ca575fd5978423631bff Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 10 Sep 2009 12:00:03 +0200 Subject: refactored the create method to actually produce meaningful error messages when something goes wrong. added tests for corner cases --- test/functional/nodes_controller_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index 08e50fd..801f2c0 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb @@ -70,6 +70,22 @@ class NodesControllerTest < ActionController::TestCase assert_equal 1, Node.last.level end + test "creating a top_level node without a title should not work" do + login_as :quentin + + assert_no_difference "Node.count" do + post(:create, :kind => "top_level") + end + end + + test "creating a generic node without a parent_id should not work" do + login_as :quentin + + assert_no_difference "Node.count" do + post(:create, :kind => "generic") + end + end + def test_editing_a_node login_as :quentin -- cgit v1.3