From 144b18c5db61c53028177680295f3fc9d4e8711d Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 18 Jul 2009 18:17:06 +0200 Subject: Test::Unit Fixtures can't handle globalize2's translated attributes which is why its impossible to set translated attributes via fixtures. Therefor I removed the page fixtures entirely and and made sure that a title is set to "Untitled" when it is not specified otherwise. If a new node is created, its initial draft has "Untitled" set as title automatically. Modified tests accordingly --- test/unit/node_test.rb | 4 ++++ test/unit/page_test.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test/unit') diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index e054887..ef298bb 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -5,7 +5,11 @@ class NodeTest < ActiveSupport::TestCase def setup @root = Node.find(1) @first_child = Node.find(2) + @first_child.pages.create! :title => "one" + @first_child.draft = @first_child.pages.last + @first_child.save @second_child = Node.find(3) + @second_child.pages.create! :title => "one" @user1 = User.create :login => 'demo', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' @user2 = User.create :login => 'show', :email => "f@b.com", :password => 'foobar', :password_confirmation => 'foobar' diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb index 8c2fc95..a2083c0 100644 --- a/test/unit/page_test.rb +++ b/test/unit/page_test.rb @@ -22,7 +22,7 @@ class PageTest < ActiveSupport::TestCase d1.tag_list = "update" d1.save n1.publish_draft! - + d2 = n1.find_or_create_draft @user1 n1.publish_draft! @@ -30,7 +30,7 @@ class PageTest < ActiveSupport::TestCase d3.tag_list = "update, pressemitteilung" d3.save n2.publish_draft! - + d4 = n2.find_or_create_draft @user1 n2.publish_draft! @@ -63,7 +63,7 @@ class PageTest < ActiveSupport::TestCase I18n.locale = :de d.body = before - d.save + d.save! assert_equal after, d.body end -- cgit v1.3