jtrupiano (owner)

Revisions

gist: 113104 Download_button fork
public
Public Clone URL: git://gist.github.com/113104.git
Ruby
1
2
3
4
5
6
7
8
require 'mocha'
 
# Used such that the named_scope chain will return a count of 0 to allow us to test "empty" messages in views
def mock_empty_named_scope(model, named_scope)
  # For any instance of model, stub the named_scope and have it return an object that responds to :count with a value of 0
  model.any_instance.stubs(named_scope).returns(mock(:count => 0))
end