require 'capybara/rspec' require 'capybara/rails' require 'capybara/poltergeist' RSpec.configure do |config| Capybara.javascript_driver = :poltergeist config.before(:each, :js) do if Capybara.javascript_driver == :selenium page.driver.browser.manage.window.maximize end end end