test/armot_test.rb in armot-0.2.5 vs test/armot_test.rb in armot-0.3.0
- old
+ new
@@ -270,11 +270,11 @@
test "should include the method in Post" do
foo = Post.methods.include?(to_method_name(:find_by_title))
assert_equal true, foo
end
- test "should be able to use super from an overrided setter" do
+ test "should be able to use super from an overrided setter for instance methods" do
# Product class has 'name' setter redefined
a = Product.create
I18n.locale = :ca
a.name = "Catalan foo"
@@ -287,8 +287,23 @@
I18n.locale = :ca
assert_equal "Catalan foo customized", a.name
I18n.locale = :en
assert_equal "English foo customized", a.name
+ end
+ test "should be able to use super for class methods" do
+ a = Product.create
+ I18n.locale = :ca
+ a.name = "Catalan foo"
+
+ I18n.locale = :en
+ a.name = "English foo"
+ a.save!
+
+ a.reload
+ I18n.locale = :ca
+
+ res = Product.find_by_name("Catalan foo customized")
+ assert_equal "Catalan foo customized_override", res
end
end