> Hello,
>
> I need mocking in a feature for code interacting with a third party
> service, in a Rails3beta4 application, with cucumber 0.8.3, cucumber-
> rails 0.3.2 and rSpec 2.0.0.beta.14.
>
> I try to add require 'spec/stubs/cucumber' in env.rb but without
> success, I get a "no such file to load -- spec/stubs/cucumber
> (LoadError)" error.
>
> When trying the solution proposed in
> http://groups.google.com/group/cukes/browse_thread/thread/522dc6323b2d34b9/dbce8743b017a17a
> and running my feature scenario (having 5 steps), I got failed initial
> and final steps: F-----F, saying my scenario 5 steps were skipped.
Your hooks have probably failed. Try running with -f pretty to see details about the error. I suspect the hack in that thread using $rspec_mocks.verify_all might not work in rspec 2.0 but I don't know that.
Have you considered using the adapter pattern and building your own fake substitute for the service instead of using mock objects?
> That's the first time I need mocking in Cucumber, maybe I miss
> something.
>
> Any help appreciated :)
>
> Florent
>
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>
/Jonas
Cucumber never had special support for RSpec stubbing.
Just refactor the code in env.rb to use the RSpec2 API.
Where did you take your stubbing code from btw?
Aslak
> this the recommended way to build Cucumber features dealing with third
> party services?
>
Ok, I see.
> and then this solution:
> http://www.google.com/url?sa=D&q=http://groups.google.com/group/cukes/browse_thread/thread/522dc6323b2d34b9/dbce8743b017a17a&usg=AFQjCNGt48AaOsJdZ9SwcPWlym_uqppcVw
>
> I'll have a look at the Rspec2 API to figure out how it differs from
> Rspec when used to stub in Cucumber. Thanks.
>
It would be nice if RSpec2 had something similar to what RSpec1 had -
maybe you can convince David to add it.
Aslak
Never mind - I added that support to Cucumber instead:
http://github.com/aslakhellesoy/cucumber/commit/4cf06933fd7aa8964299bb2dfa56256a0c2a0035
http://wiki.github.com/aslakhellesoy/cucumber/mocking-and-stubbing-with-cucumber
There is something wrong with the Github wiki. It seems like they are
not ivalidating the wiki page caches properly. Hit edit on the page to
see the updates I just made.
Aslak