cucumber - Switching Capybara drivers with environment variables -
i running cucumber tests capybara , want able run sets of tests different drivers selenium or poltergeist. i've registered drivers , can switch between them environment variables in following fashion:
if env['default_driver'] == ":poltergeist" capybara.default_driver = :poltergeist end
my question is, there way pass driver in environment variable without use of if blocks?
ideally, i'd capybara.default_driver = env['default_driver'] || :selenium
produces errors.
you should use to_sym
convert env variable symbol, remove colon variable. right using ":poltergeist", string, instead of :poltergeist
, symbol.
capybara.default_driver = env['default_driver'].to_sym
work if env['default_driver']
"poltergeist".
Comments
Post a Comment