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

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -