Joe Van Dyk
2009-Feb-28 20:04 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
Is it possible to have a scenario where you are testing the interaction between two different session? i.e. Given User A clicks this link Then User B should see this It used to be possible, but don''t know if it still is. Joe
Joe,I would test this in 2 steps. I''d first test that whatever state change (or whatever happens when you User A clicks the link) takes place. Then in another test, I''d check that, given a certain state (or again, whatever is supposed to happen), then User B sees whatever. HTH, BJ Clark On Sat, Feb 28, 2009 at 12:04 PM, Joe Van Dyk <joe at pinkpucker.net> wrote:> Is it possible to have a scenario where you are testing the > interaction between two different session? > > i.e. > > Given User A clicks this link > Then User B should see this > > It used to be possible, but don''t know if it still is. > > Joe > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090228/46f6a030/attachment.html>
Joe Van Dyk
2009-Mar-02 01:04 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
So you''re saying no? :D On Sat, Feb 28, 2009 at 5:17 PM, BJ Clark <bj at aboutus.org> wrote:> Joe, > I would test this in 2 steps. > I''d first test that whatever state change (or whatever happens when you User > A clicks the link) takes place. > Then in another test, I''d check that, given a certain state (or again, > whatever is supposed to happen), then User B sees whatever. > HTH, > BJ Clark > > On Sat, Feb 28, 2009 at 12:04 PM, Joe Van Dyk <joe at pinkpucker.net> wrote: >> >> Is it possible to have a scenario where you are testing the >> interaction between two different session? >> >> i.e. >> >> Given User A clicks this link >> Then User B should see this >> >> It used to be possible, but don''t know if it still is. >> >> Joe >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Zach Dennis
2009-Mar-02 02:14 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
On Sun, Mar 1, 2009 at 8:04 PM, Joe Van Dyk <joevandyk at gmail.com> wrote:> So you''re saying no? ?:DIt is possible, you simply have to logout from UserA and log in as UserB. Also, although it''s not exposed with webrat IIRC it is possible to have selenium run to separate browsers at the same time. You could theoretically have UserA and UserB logged in concurrently doing their thing, Zach> > On Sat, Feb 28, 2009 at 5:17 PM, BJ Clark <bj at aboutus.org> wrote: >> Joe, >> I would test this in 2 steps. >> I''d first test that whatever state change (or whatever happens when you User >> A clicks the link) takes place. >> Then in another test, I''d check that, given a certain state (or again, >> whatever is supposed to happen), then User B sees whatever. >> HTH, >> BJ Clark >> >> On Sat, Feb 28, 2009 at 12:04 PM, Joe Van Dyk <joe at pinkpucker.net> wrote: >>> >>> Is it possible to have a scenario where you are testing the >>> interaction between two different session? >>> >>> i.e. >>> >>> Given User A clicks this link >>> Then User B should see this >>> >>> It used to be possible, but don''t know if it still is. >>> >>> Joe >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com
Ben Mabey
2009-Mar-02 03:46 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
Joe Van Dyk wrote:> Is it possible to have a scenario where you are testing the > interaction between two different session? > > i.e. > > Given User A clicks this link > Then User B should see this > > It used to be possible, but don''t know if it still is. > > Joe > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Have you tried creating a new webrat session? I haven''t looked into it myself, but like you said it was possible. Not much has changed with the underling rails integration session so I imagine that if you just created a new webrat session and used that for user B then you should be fine. (So, you will have to store this second session as an instance var in the other session.. kinda odd but I would try it.) I would be interested to hear if this works, so please report back. BTW, you might get some better answers on the webrat mailing list. -Ben
Bart Zonneveld
2009-Mar-02 14:15 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
On 28-feb-2009, at 21:04, Joe Van Dyk wrote:> Is it possible to have a scenario where you are testing the > interaction between two different session?If you mean something along these lines: User A uploads a picture, User B logs in to see the picture uploaded by User A that is possible. I use this construct a lot to test-drive some revisions code I came up with. Something like: Given I am logged in And there is an article And the title of the article has been modified twice When I compare the revisions Then I should see the difference in title GIven "the title of the article has been modified twice" do Given "I am logged in as an editor" 2.times do |i| visit edit_article_path(@article) fill_in "Title", :with => "Title #{i}" click_button "Save" end Given "I am logged in as a writer" end cheers, bartz
Eric Kramer
2009-Apr-22 20:50 UTC
[rspec-users] testing multiple sessions in cucumber/webrat
Joe Van Dyk wrote:> Is it possible to have a scenario where you are testing the > interaction between two different session?Not sure if this is exactly what you need, but I found this technique to be very handy: http://erikonrails.snowedin.net/?p=159 It involves mixing in a method to ActionController::Integration::Session so that you can create a step definition that happens "outside" the current session: module ActionController module Integration class Session def in_a_separate_session old = @response.clone yield @response = old end end end end Here''s a sample usage from his page: Then /^I should be logged in$/ do in_a_separate_session do Given "I visit /users/me" Then "I should see \"You are logged in\"" end end -- Posted via http://www.ruby-forum.com/.