Created
May 17, 2009 19:00
-
-
Save jtrupiano/113104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment