diff options
| author | hukl <contact@smyck.org> | 2009-02-21 14:27:08 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-21 14:27:08 +0100 |
| commit | edf4a4783c454ec6e5e63d70bac716b3821768eb (patch) | |
| tree | 4a694f5f36cd68dc8b33647c27cb798e32127322 /test/unit/node_test.rb | |
| parent | 3f0b690d8f0011dfdcc32af2626eef473f9111b5 (diff) | |
cloning now with all the translations. test added
Diffstat (limited to 'test/unit/node_test.rb')
| -rw-r--r-- | test/unit/node_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index 937c3e0..d0c088e 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb | |||
| @@ -11,6 +11,34 @@ 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_cloning_a_head_page_to_a_new_draft_with_translations | ||
| 15 | assert_not_nil draft = @first_child.draft | ||
| 16 | I18n.locale = :de | ||
| 17 | draft.title = "Hallo" | ||
| 18 | draft.abstract = "Bitte" | ||
| 19 | draft.body = "Danke" | ||
| 20 | draft.save | ||
| 21 | I18n.locale = :en | ||
| 22 | draft.title = "Hello" | ||
| 23 | draft.abstract = "Please" | ||
| 24 | draft.body = "Thanks" | ||
| 25 | draft.save | ||
| 26 | |||
| 27 | @first_child.publish_draft! | ||
| 28 | |||
| 29 | draft1 = @first_child.find_or_create_draft(@user1) | ||
| 30 | |||
| 31 | I18n.locale = :de | ||
| 32 | assert_equal "Hallo", draft1.title | ||
| 33 | assert_equal "Bitte", draft1.abstract | ||
| 34 | assert_equal "Danke", draft1.body | ||
| 35 | |||
| 36 | I18n.locale = :en | ||
| 37 | assert_equal "Hello", draft1.title | ||
| 38 | assert_equal "Please", draft1.abstract | ||
| 39 | assert_equal "Thanks", draft1.body | ||
| 40 | end | ||
| 41 | |||
| 14 | def test_created_nodes_have_an_empty_draft_and_no_head | 42 | def test_created_nodes_have_an_empty_draft_and_no_head |
| 15 | node = Node.create :slug => "third_child" | 43 | node = Node.create :slug => "third_child" |
| 16 | node.move_to_child_of @root | 44 | node.move_to_child_of @root |
