From f671d3c3976c1b641fe2274668ecca82bf9b16cc Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 14 Nov 2009 10:52:07 +0100 Subject: Just a test that only one root node can be created. Closes #32 --- test/unit/node_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/unit/node_test.rb') diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index 77e9cad..dd010cd 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -15,6 +15,14 @@ class NodeTest < ActiveSupport::TestCase @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' end + test "can only create one root node" do + Node.delete_all + Node.create! :slug => :root + assert_raise(ActiveRecord::RecordInvalid) do + Node.create! :slug => :root + end + end + def test_returning_existing_drafts test_node = Node.root.children.create! :slug => "test_node" -- cgit v1.3