module Shoulda::ActiveRecord::Matchers
def have_named_scope(scope_call)
end
scoped(:limit => c)
def self.recent(c)
Or for
named_scope :recent, lambda {|c| {:limit => c}}
Passes for
it { should have_named_scope('recent(1)').finding(:limit => 1) }
it { should have_named_scope('recent(5)').finding(:limit => 5) }
You can test lambdas or methods that return ActiveRecord#scoped calls:
end
scoped(:conditions => {:visible => true})
def self.visible
Or for
named_scope :visible, :conditions => {:visible => true}
Passes for
finding(:conditions => {:visible => true}) }
it { should have_named_scope(:visible).
Example:
pass on to find.
* in_context - Any of the options that the named scope would
Options:
instance variables that an example would.
which will be evaled. The eval'd method call has access to all the same
scope_call can be either a symbol, or a Ruby expression in a String
NamedScope object with the proxy options set to the options you supply.
Ensures that the model has a method named scope_call that returns a
def have_named_scope(scope_call) HaveNamedScopeMatcher.new(scope_call).in_context(self) end