2009/10/4 Richard Schneeman <rails-mailing-l...@andreas-s.net>:
>
> I just started using rspec and mocha to test all of my controllers.
> Before I was using factory girl to test do my testing, but all those
> database hits really take a long time. However i'm finding i'm spending
> way more time writing stubs and mocks to satisfy my controllers than I
> am actually writing tests.
>
> This is a two part general question
> 1) Am i doing something completely wrong in my controllers? I'm testing
> with integrate_views and the number of times something.stubs(:each)
> comes up way to often in my specs. Most of my controllers involve at
> least 2 normally 3 models.
>
> 2) Is there a way to auto generate stubs and mocks like factory-girl, so
> i don't have to worry about populating every last property of every last
> mock_model'd ? I can just call Mock_Factory.create(:website) and set up
> a list of defaults somewhere else?
>
>
> I feel like my stubs and mocks are supposed to help me, not confuse me:
>
> http://pastie.org/641647
>
> Your thoughts?

Hi Richard,

I haven't used it myself, but you might find this thread [1] of
interest. In particular, Murray Steele's fork [2] of factory_girl
sounds a bit like what you are looking for.

Alternatively, David Chelimsky's Stubble [3] might offer an
alternative approach, although I think that currently requires a small
patch to Mocha.

Regards, James.
http://blog.floehopper.org/

[1] http://rubyurl.com/23WA
[2] http://github.com/h-lame/factory_girl/tree/master
[3] http://github.com/dchelimsky/stubble

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to