[rspec-users] stubbing with and without a string

David Chelimsky dchelimsky at gmail.com
Fri Apr 20 12:26:27 EDT 2007


On 4/20/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>
> What exactly does the mock_model do which is different from the
> regular mock ?

It stubs out a bunch of stuff commonly required by rails. Take a look
at the code for details - just search for "def mock_model" in the
rspec plugin (I'd tell you exactly where to look but it's moved around
a couple of times so it depends on which version you have).

>
>
> Scott
>
> On Apr 20, 2007, at 11:29 AM, David Chelimsky wrote:
>
> > On 4/20/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> >> What is the difference between these two ways of mocking (with and
> >> without the string):
> >>
> >> mock('Object')
> >>
> >> and
> >>
> >> mock(Object)
> >>
> >> ?
> >>
> >> Scott
> >
> > IIRC, using the #mock method, there is really no difference (are you
> > observing any difference?). Using the Spec::Rails mock_model method,
> > you must use the class instead of a String.
> >
> > There *was* talk at one point of adding a feature that would allow you
> > to run examples w/ a command line switch that would look for all the
> > mocks created w/ mock(Type) and report back if the type didn't
> > actually support the expected methods. But that's not present so
> > there's really no diff now.
> >
> >
> >> _______________________________________________
> >> rspec-users mailing list
> >> rspec-users at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/rspec-users
> >>
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list