Skip to content

Instantly share code, notes, and snippets.

@avit
Created April 4, 2013 18:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avit/5313135 to your computer and use it in GitHub Desktop.
Save avit/5313135 to your computer and use it in GitHub Desktop.
# Mock all calls through .find on an ActiveRecord model
# or its chained scopes
def expect_find(model)
@scope ||= model.scoped
model.stub!(:scoped).and_return @scope
@scope.should_receive(:find).ordered
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment