diff options
| author | hukl <contact@smyck.org> | 2009-11-14 10:52:07 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-11-14 10:52:07 +0100 |
| commit | f671d3c3976c1b641fe2274668ecca82bf9b16cc (patch) | |
| tree | 0f1fa1f29a710360e38c2993d86c6f99ee739598 | |
| parent | 14e3a355fb4c68cc6ab8d123e107e65b8511bd6f (diff) | |
Just a test that only one root node can be created. Closes #32
| -rw-r--r-- | test/unit/node_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 | |||
| 15 | @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' | 15 | @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | test "can only create one root node" do | ||
| 19 | Node.delete_all | ||
| 20 | Node.create! :slug => :root | ||
| 21 | assert_raise(ActiveRecord::RecordInvalid) do | ||
| 22 | Node.create! :slug => :root | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 18 | def test_returning_existing_drafts | 26 | def test_returning_existing_drafts |
| 19 | test_node = Node.root.children.create! :slug => "test_node" | 27 | test_node = Node.root.children.create! :slug => "test_node" |
| 20 | 28 | ||
