oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
656 stars 170 forks source link

Capybara::DriverNotFoundError: no driver called :poltergeist_billy was found #254

Closed jyr closed 5 years ago

jyr commented 5 years ago

Hi,

I'm trying to use :poltergeist_billy with rspec and have the error:

Capybara::DriverNotFoundError: no driver called :poltergeist_billy was found, available drivers: :rack_test, :selenium, :poltergeist

my spec_helper:

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
require 'capybara-screenshot/rspec'

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

Billy.configure do |c|
  c.cache = true
  c.persist_cache = true
  c.cache_path = 'spec/req_cache/'
end

# need to call this because of a race condition between persist_cache
# being set and the proxy being loaded for the first time
Billy.proxy.restore_cache

RSpec.configure do |config|
  config.formatter = :documentation
  config.color = true
  config.tty = true
  config.profile_examples = true

  config.use_transactional_fixtures = false
  config.use_transactional_examples = false
  config.order = "random"
  config.infer_base_class_for_anonymous_controllers = false

  Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, inspector: true, js_errors: false, timeout: 80, default_wait_time: 30, debug: false,
                                      phantomjs_options: ['--debug=no', '--load-images=no'],
                                      phantomjs_logger: File.open("#{Rails.root}/log/test_phantomjs.log", "a"))
  end

  Capybara.javascript_driver = :poltergeist_billy
  Capybara.always_include_port = true

  config.before :each do
    if Capybara.current_driver == :rack_test
      DatabaseCleaner.strategy = :transaction
    else
      DatabaseCleaner.strategy = :truncation
    end
    DatabaseCleaner.start
    Timecop.return
  end

  config.after do
    DatabaseCleaner.clean
  end

end

I'm using ruby-2.1.5 and rails-3.2.13 with rspec-2.14.1

Any tip? Thanks

ronwsmith commented 5 years ago

Looks like you're missing require 'billy/capybara/rspec'

jyr commented 5 years ago

Yes, I tried with require 'billy/capybara/rspec' and have the next error:


vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- billy/capybara/rspec (LoadError)```
jyr commented 5 years ago

I have puffing-billy-0.5.1, so works with require 'billy/rspec'

Thanks