diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/node_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index d0c088e..549cccd 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb | |||
| @@ -11,6 +11,33 @@ class NodeTest < ActiveSupport::TestCase | |||
| 11 | @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' | 11 | @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' |
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | def test_user_gets_assigned_to_unlocked_draft | ||
| 15 | assert_not_nil @first_child.draft | ||
| 16 | assert_nil @first_child.draft.user | ||
| 17 | @first_child.find_or_create_draft @user1 | ||
| 18 | assert_equal @user1, @first_child.draft.user | ||
| 19 | end | ||
| 20 | |||
| 21 | def test_unique_path_returns_an_array | ||
| 22 | assert_equal ["first_child"], @first_child.unique_path | ||
| 23 | |||
| 24 | new_node = Node.create! :slug => "third_child" | ||
| 25 | new_node.move_to_child_of @first_child | ||
| 26 | |||
| 27 | assert_equal ["first_child", "third_child"], new_node.unique_path | ||
| 28 | end | ||
| 29 | |||
| 30 | def test_specifying_a_revision_other_than_with_a_fixnum_raises_exception | ||
| 31 | assert_raise(ArgumentError) { Node.find_page "first_child", 1.9 } | ||
| 32 | assert_raise(ArgumentError) { Node.find_page "first_child", "1" } | ||
| 33 | assert_raise(ArgumentError) { Node.find_page "first_child", :head } | ||
| 34 | end | ||
| 35 | |||
| 36 | def test_publish_draft_on_a_node_without_a_draft_returns_nil | ||
| 37 | assert @first_child.publish_draft! | ||
| 38 | assert_nil @first_child.publish_draft! | ||
| 39 | end | ||
| 40 | |||
| 14 | def test_cloning_a_head_page_to_a_new_draft_with_translations | 41 | def test_cloning_a_head_page_to_a_new_draft_with_translations |
| 15 | assert_not_nil draft = @first_child.draft | 42 | assert_not_nil draft = @first_child.draft |
| 16 | I18n.locale = :de | 43 | I18n.locale = :de |
