[Rspec-devel] New proc.should_increment method

aslak hellesoy aslak.hellesoy at gmail.com
Fri Jul 14 15:14:07 EDT 2006

On 7/14/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> On 7/14/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> > Would it make sense to add your acts_as_mock plugin to RSpec core?
> Definitely. That's my plan, but right now it's fairly alpha.
> I did create a branch called mocks_as_module in which I'm exploring
> merging the act_as_mocks concepts w/ the current rspec mocking
> framework by moving the rspec methods to a module that gets included
> in the Mock class. Then the plugin can include the same stuff in
> ActiveRecord::Base and we're off and running. Nothing committed there
> yet, but there will be in the next day or so.

That sounds good. I'm looking forward to that.

One thing I'd like to instead of:

  thing = mock("thing")

is to do:

  thing = mock(Thing) # passing a class rather than a string

-and have the mock fail if you tell it to expect a message that is not
defined by Thing.
This goes against duck typing, but it can also be useful in 'forcing'
the implementation of certain methods in your mocked
roles/collaborators. -Which is a common design technique with mock
libraries for static languages.

How would this fit with your acts_as_mock?


> David
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the Rspec-devel mailing list