test/armot_test.rb in armot-0.3.3 vs test/armot_test.rb in armot-0.3.4
- old
+ new
@@ -508,6 +508,28 @@
assert_equal false, foo.respond_to?(:title_sk)
FuzzBar.reload_localized_accessors_for :title
assert_equal true, foo.respond_to?(:title_sk)
end
+
+ test "should work if the I18n backend has not fallbacks" do
+ with_no_method(I18n.singleton_class, :fallbacks) do
+ assert_equal false, I18n.respond_to?(:fallbacks)
+
+ post = Post.last
+ I18n.locale = :pt
+ assert_equal nil, post.title
+ end
+ end
+
+ test "define_localized_accessors_for with specific locales" do
+ class FuzzBarTwo < Post
+ define_localized_accessors_for :title, :locales => [:love, :hate]
+ end
+
+ foo = FuzzBarTwo.new
+ assert_equal true, foo.respond_to?(:title_love)
+ assert_equal true, foo.respond_to?(:"title_love=")
+ assert_equal true, foo.respond_to?(:title_hate)
+ assert_equal true, foo.respond_to?(:"title_hate=")
+ end
end