test/test_translatable.rb in translatable-0.2.1 vs test/test_translatable.rb in translatable-0.2.2
- old
+ new
@@ -89,10 +89,22 @@
assert_equal "Заголовок", t_news.title
assert_equal "Содержание", t_news.content
assert_equal "ru", t_news.locale
end
+ def test_no_other_translations
+ news = News.create :translations_attributes => [{ :title => "Заголовок", :content => "Содержание", :locale => "ru"}]
+
+ assert news.persisted?
+
+ t_news = TranslatableNews.last
+ assert_equal [t_news], news.other_translations
+ ::I18n.locale = :ru
+ assert_equal [], news.other_translations
+ ::I18n.locale = ::I18n.default_locale
+ end
+
def test_create_with_translation_with_multiple_locales
news = News.create :translations_attributes => [{ :title => "Заголовок", :content => "Содержание", :locale => "ru"},
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
assert news.persisted?
@@ -118,10 +130,10 @@
assert_equal "Resent News", news.title
assert_equal "That is where the text goes", news.content
end
- def test_access_of_other_translation
+ def test_access_of_different_translation
news = News.create :translations_attributes => [{:title => "Заголовок", :content => "Содержание", :locale => "ru"},
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
assert news.persisted?