Skip to content

Instantly share code, notes, and snippets.

@roykolak
Created April 26, 2011 18:11
Show Gist options
  • Save roykolak/942774 to your computer and use it in GitHub Desktop.
Save roykolak/942774 to your computer and use it in GitHub Desktop.
Just a simple method to switch capybara to a different driver and then change back to the default
feature 'viewing the webpage' do
switch_driver :webkit
scenario 'viewing from a webkit browser' do
...
end
end
# In support folder
def switch_driver(driver_name)
before(:each) do
Capybara.current_driver = driver_name
end
after(:each) do
Capybara.use_default_driver
end
end
@philly-mac
Copy link

Interesting. Not sure if I will need to do this, as I don't use cucumber. I use bacon for testing and I think it may work using that. If not normally then I will try putting the it 'should blah blah blah....' do in the switch_driver block and see if that works. If not, it is good to know that there is this example that I can come back to which works.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment