Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-20 Thread David Chelimsky
On Jun 20, 2010, at 1:30 AM, Matt Wynne wrote: > > On 19 Jun 2010, at 00:35, David Chelimsky wrote: > >> On Jun 18, 2010, at 5:02 PM, Marcelo de Moraes Serpa wrote: >> >>> Hi David, thanks for the reply, >>> >>> Hmm, considering we have: >>> 1) The ruby process where the spec is running >>>

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-19 Thread Matt Wynne
On 19 Jun 2010, at 00:35, David Chelimsky wrote: > On Jun 18, 2010, at 5:02 PM, Marcelo de Moraes Serpa wrote: > >> Hi David, thanks for the reply, >> >> Hmm, considering we have: >> 1) The ruby process where the spec is running >> 2) A mongrel server serving request (test environment) >> >>

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Adam Sroka
What I typically do is wrap any Ajax calls on the client side with JavaScript objects. Then it is fairly trivial to stub the calls by just redefining the methods that would normally call the server. For acceptance testing I would normally just do it end-to-end and not mock. However, if there is so

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread David Chelimsky
On Jun 18, 2010, at 5:02 PM, Marcelo de Moraes Serpa wrote: > Hi David, thanks for the reply, > > Hmm, considering we have: > 1) The ruby process where the spec is running > 2) A mongrel server serving request (test environment) > > If I call FakeWeb on #1, it won't work on #2, since they are

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
Hi David, thanks for the reply, Hmm, considering we have: 1) The ruby process where the spec is running 2) A mongrel server serving request (test environment) If I call FakeWeb on #1, it won't work on #2, since they are separated processes and FakeWeb would only monkeypatch Net::HTTP for #1. Or

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread David Chelimsky
On Jun 18, 2010, at 12:02 PM, Marcelo de Moraes Serpa wrote: > One thing that just came to my mind is to fake the requests on the app server > instance. One simple way to do that would be to just put the FakeWeb call in > a cucumber / culerity environment file. However, this is far from being >

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
One thing that just came to my mind is to fake the requests on the app server instance. One simple way to do that would be to just put the FakeWeb call in a cucumber / culerity environment file. However, this is far from being elegant and is not scalable at all, as the call would be contextless to

[rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
Hello all, I have an acceptance test that aims to bdd a Google Apps OpenID authentication feature. This login screen also uses some JS (in order to switch between the regular / Google OpenID forms). Now, I know this is not something that would prevent me from using the :rack driver for Capybara, b