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
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
So you’re saying no?
On Sun, Mar 1, 2009 at 8:04 PM, Joe Van D. [email protected] wrote:
So you’re saying no?
It 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
It used to be possible, but don’t know if it still is.
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users
–
Zach D.
http://www.continuousthinking.com
On 28-feb-2009, at 21:04, Joe Van D. 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
Joe Van D. wrote:
Joe
rspec-users mailing list
[email protected]
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
Joe Van D. 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs