[rspec-users] Pass a variable from rake to steps file in cucumber

AndreXP andre.x.pretorius at gmail.com
Fri Jan 30 07:26:20 EST 2009

Can anybody tell me how to pass a variable from the rake command to my steps
file using cucumber? I have the following in my Rakefile:
## Rakefile
Cucumber::Rake::Task.new do |t|
  profile = ENV['PROFILE'] || 'default'
  browser_type = ENV['BROWSER'] || '*chrome'
  t.cucumber_opts = "--profile #{profile}"
I would like to have access to the "browser_type" variable in my "Before do"
in my_steps.rb file.
## my_steps.rb
Before do
  $browser = Selenium::SeleniumDriver.new($server_host, $server_port,
"browser_type", $root_url, $time_out)
Thanks for the help. 
View this message in context: http://www.nabble.com/Pass-a-variable-from-rake-to-steps-file-in-cucumber-tp21746008p21746008.html
Sent from the rspec-users mailing list archive at Nabble.com.

More information about the rspec-users mailing list