module ThoughtBot::Shoulda::ActiveRecord::Macros

def should_have_named_scope(scope_call, *args)


end
scoped(:limit => c)
def self.recent(c)

Or for

named_scope :recent, lambda {|c| {:limit => c}}
Passes for

should_have_named_scope 'recent(1)', :limit => 1
should_have_named_scope 'recent(5)', :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

should_have_named_scope :visible, :conditions => {:visible => true}

Example:

Options: Any of the options that the named scope would pass on to find.

instance variables that a should statement would.
call which will be evaled against the model. The eval'd method call has access to all the same
proxy options set to the options you supply. scope_name can be either a symbol, or a method
Ensures that the model has a method named scope_name that returns a NamedScope object with the
def should_have_named_scope(scope_call, *args)
  klass = model_class
  scope_opts = args.extract_options!
  scope_call = scope_call.to_s
  context scope_call do
    setup do
      @scope = eval("#{klass}.#{scope_call}")
    end
    should "return a scope object" do
      assert_equal ::ActiveRecord::NamedScope::Scope, @scope.class
    end
    unless scope_opts.empty?
      should "scope itself to #{scope_opts.inspect}" do
        assert_equal scope_opts, @scope.proxy_options
      end
    end
  end
end