The traditional way to do this would be to create a ticket in the second test without going through the browser (so using whatever database ORM/API you have), then check you can look it up. This avoids sharing state between the tests and creating a dependency between them.
Jon Rowe --------------------------- [email protected] jonrowe.co.uk On Wednesday, 17 September 2014 at 6:59, Dan Franko wrote: > Hello. I've been struggling with this for quite some time and I'm hoping > someone can help out. The answer is probably right in front of me! I'm > using rspec with watir-webdriver for regression tests and I want to do > something simple like create a ticket and then lookup that same ticket in an > isolated manner. Is this possible and what would be the best way to go about > it? I can do this with a differently scoped variable, but that doesn't > appear to be the correct way to approach this. Thanks! > > describe "Ticketing system",:template do > > before(:all) do > > > > > > > > > > @b = Watir::Browser.start("google.com (http://google.com)",:chrome) > > > > > > > > > > > > > > end > > > > > > > > > > > > > it 'can create a ticket' do > > > > > > > > > > @b.link(:text => "Create ticket") > > > > > > > > > > > > > > > ticket = @b.div(:id => "ticket").text > > > > > > > > > > > > > > > expect(ticket).to eql(123456) > > > > > > > > > > > > > > end > > > > > > > > > > it 'can lookup a created ticket' do > > > @b.text_field(:id => "search").set(ticket) > > > > > > > > > > > > > > end > > > > > > > > > > after(:all) do > > > @b.close rescue nil > > > > > > > > > > > > > > end > > > > > > > > end > > > > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > (mailto:[email protected]). > To post to this group, send email to [email protected] > (mailto:[email protected]). > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/1ec2fa65-8c60-4fda-aa83-5f074c0bb69a%40googlegroups.com > > (https://groups.google.com/d/msgid/rspec/1ec2fa65-8c60-4fda-aa83-5f074c0bb69a%40googlegroups.com?utm_medium=email&utm_source=footer). > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/7E39453D727C498FB8238B58860DA144%40jonrowe.co.uk. For more options, visit https://groups.google.com/d/optout.
