Permalink
Browse files

Dynamic finder method like scoped_by_* create methods so that

method_missing is not hit next time. Adding a test for this
scenario.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 807239f commit db1c484c55758e25c56615d6efdab8a22cff4a46 Neeraj Singh committed with josevalim Aug 3, 2010
Showing with 6 additions and 0 deletions.
  1. +6 −0 activerecord/test/cases/named_scope_test.rb
@@ -478,4 +478,10 @@ def test_dynamic_scope
assert_equal Post.scoped_by_author_id(1).find(1), Post.find(1)
assert_equal Post.scoped_by_author_id_and_title(1, "Welcome to the weblog").first, Post.find(:first, :conditions => { :author_id => 1, :title => "Welcome to the weblog"})
end
+
+ def test_dynamic_scope_should_create_methods_after_hitting_method_missing
+ assert Developer.methods.grep(/scoped_by_created_at/).blank?
+ Developer.scoped_by_created_at(nil)
+ assert Developer.methods.grep(/scoped_by_created_at/).present?
+ end
end

0 comments on commit db1c484

Please sign in to comment.