[rspec-users] Appropriate adapter (Rails, Cucumber)

Joseph Wilk joe at josephwilk.net
Mon Apr 20 05:50:44 EDT 2009

Julian Leviston wrote:
> Hi All,
> I've got a bunch of tests written in cucumber, and they're all 
> lovely... this is rails testing i'm doing by the way.... and now I'm 
> coming to testing the javascript and AJAX parts of the app... and I've 
> decided to plug in selenium... my issue is, I'd like to select which 
> adapter to use on a per-scenario basis... is there any easy way to do 
> this, and yet still maintain the no-implementation-details in the 
> cucumber side type of thing that cucumber encourages...
> I mean, basically, I just want it to use the fastest method 
> possible.... so for non-ajax/non-js stuff, I'd like it to use the 
> default adapter and others I'd like it to use selenium....
> Julian.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Have you looked at using Cucumber's Tagging feature? 

Scenario: I'm javascript

Scenario: I'm not using javascript

#Run scenarios excluding any that are tagged as js
 > cucumber --tags ~@js features/

#Run just the js scenarios.
 > cucumber --tags @js features/

So you have two separate runs of Cucumber. Hence you could have a env.rb 
for each. One that loads Selenium (or Webrat driving Selenium) and the 
other Webrat.

Joseph Wilk

More information about the rspec-users mailing list