[Rspec-devel] define_instance_method, stub_with, and mock_with

David Chelimsky dchelimsky at gmail.com
Mon Sep 4 22:20:31 EDT 2006

On 9/4/06, David Astels <dastels at daveastels.com> wrote:
> Hash: SHA1
> On 4-Sep-06, at 8:49 PM, David Astels wrote:
> > I will be looking hard at mocha/stubba tonight, but they look like a
> > good way to go.  I'm quite happy to have us depricate rSpec's mock
> > framework in favour of mocha/stubba.
> Well.. on first glance Mocha seems significantly inferior to rSpec
> mocks.  No support for consecutive calls, primitive argument
> matching, no ordering, and a rather clunky syntax.
> I have an alternative suggestion.  We make the mocking framework
> pluggable.  There are two points on integration to worry about:
> creating a mock and verifying all created mocks.  A single require in
> your spec file to override the builting mocks with mocha would do
> it.

This is what Aslak and I were talking about - but not an override.
Start by requiring the require explicitly:

require 'rspec'
require 'rspec/mock'

Then the latter could be replaced w/ mocha, flexmock, whatever anyone
wishes. As long as the framework in question provides the hooks we
need to register an instance on creation and verify at the end of a

> Or something less intrusive... a small mock plugin file that
> rspec requires... install the appropriate one for the mock framework
> of choice.  No reason we couldn't directly support flexmock in this
> way as well.  Then we could extract our mock framework as a
> standalone piece.. a separate project even.  Then anyone could
> install rspec, their mock framework of choice, and the small piece to
> bind them together.
> Dave
> Version: GnuPG v1.4.3 (Darwin)
> iD8DBQFE/MB9auez/L4x7g4RAm7GAKCoztPcBXTbbWfxHrQSl4egp78bewCgpcfm
> ewwz2YW145GK+tSeGD0O3dM=
> =D8Fk
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the Rspec-devel mailing list