--
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.
> On Thu, Nov 26, 2009 at 9:37 AM, l.me...@tu-bs.de <l.me...@tu-bs.de>It depends. I'm developing a site right now that uses OpenID and
> wrote:
>>
>> Since I know that stubbing should be avoided were possible for
>> cucumber, I need to simply stub out my "logged_in?" method to work
>> around the problem with sessions not being persisted across requests.
>>
>> How do I stub out an instance method of a Sinatra::Application form
>> within a Cucumber step (or in a Hook). Where to I get access to the
>> application instance. Currently I can only find the "app" instance
>> variable of the world, which returns my Application's class but not
>> the current Instance.
>>
>> Any suggestions?
>
> You are right. Stubbing should be avoided because you are doing an
> integration test. This means that there shouldn't be any stub whatsoever.
>
OAuth, and we're stubbing out all the network traffic with Fakeweb forfailure).
our Cucumber scenarios. (We also have scenarios that simulate network
We could have used Watir or something to do a true end-to-end with the
external provider (Google), but decided it was more pragmatic to stub
it out and do some manual tests to verify that things were working
Thanks for the suggestions, I ended up doing it like you described (reopening my application class and overriding those methods, see http://stackoverflow.com/questions/1800333/stubbing-sinatra-helper-in-cucumber)I am doing my integration test using Webrat (should ahve mentioned that before, sorry)I would loved to use the login action from outside (post to /auth in my case) but the problem is the session handling. The session isn't persisted that way subsequent requests to protected actions will fail since I am not logged in anymore. this seems to be a known problem (http://github.com/erikpukinskis/sinatra-webrat-session-test)So if you have a solution for this, I'd love to skip the workaround and perform the login action "for real".
On Thu, Nov 26, 2009 at 12:22 PM, Lennart Melzer <l.me...@tu-bs.de> wrote:Thanks for the suggestions, I ended up doing it like you described (reopening my application class and overriding those methods, see http://stackoverflow.com/questions/1800333/stubbing-sinatra-helper-in-cucumber)I am doing my integration test using Webrat (should ahve mentioned that before, sorry)I would loved to use the login action from outside (post to /auth in my case) but the problem is the session handling. The session isn't persisted that way subsequent requests to protected actions will fail since I am not logged in anymore. this seems to be a known problem (http://github.com/erikpukinskis/sinatra-webrat-session-test)So if you have a solution for this, I'd love to skip the workaround and perform the login action "for real".
You might want to try out http://github.com/jnicklas/capybara instead of webrat
This is a similar framework as webrat (although new, see posts from a couple of days ago), but it works on the rack level so it might workout better for you since you are using sinatra. The dsl is supposed to be compatible with webrat.
Haven't tried it out yet, but the first reactions were positive. Please let us know if you go this route and how it goes.
Jeroen
Is that deprecation in the webrat gem or just the HEAD from brynary's
On 26 Nov 2009, at 12:30, Ben Lovell wrote:
> Just an FYI that webrat has an adapter for rack too. In fact it is
> the recommended approach when testing Sinatra apps. The old sinatra
> approach has been deprecated in favour of this.
github?
cheers,
Matt