[rspec-users] Cucumber - stub! or mock?
lists at ruby-forum.com
Mon Sep 15 17:01:29 EDT 2008
Tim Glen wrote:
> 1. Is there a way to stub out the model to return some fixture-type
> 2. Does anyone have an idea as to how we could refactor this into a
> better pattern? Those 2 "projects" are pretty specific to the
> production data and will "never be edited," but it still doesn't make
> me comfortable.
> I'm not sure how to phrase this better. Let me know what other detail
> I can provide to make it more clear what I'm looking for.
As Pat said I would avoid mocking/stubbing, you want your cucumber tests
to cut through all the layers of your app including touching the
As for setting up the data, I tend not to use fixtures (I only want to
have the data created for certain tests). Instead I save the relevant
models in the Given steps, preparing for the feature test. If you are
going to repeat the given steps a lot I would extract the model set-up
into a ruby function and reuse this.
Posted via http://www.ruby-forum.com/.
More information about the rspec-users