ruby on rails - Capybara webkit allow unknown urls is not being set -


i using capybara webkit of rspec tests in rails application. want allow_unknown_urls , have set in spec_helper.rb file per guide global configuration here https://github.com/thoughtbot/capybara-webkit/ - current spec_helper.rb file:

# file generated `rails generate rspec:install` command. conventionally, # specs live under `spec` directory, rspec adds `$load_path`. # generated `.rspec` file contains `--require spec_helper` cause # file loaded, without need explicitly require in # files. # # given loaded, encouraged keep file # light-weight possible. requiring heavyweight dependencies file # add boot time of test suite on every test run, # individual file may not need of loaded. instead, consider making # separate helper file requires additional dependencies , performs # additional setup, , require spec files need # it. # # `.rspec` file contains few flags not defaults # users commonly want. # # see http://rubydoc.info/gems/rspec-core/rspec/core/configuration env["rails_env"] ||= "test" env['server_name'] = "user.myapp.com"  require file.expand_path("../../config/environment", __file__) require "rspec/rails"   capybara::webkit.configure |config|   # enable debug mode. prints log of driver doing.   config.debug = false    config.allow_unknown_urls   # allow pages make requests url without issuing warning.    # allow specifc domain without issuing warning.   config.allow_url("checkout.stripe.com")      # timeout if requests take longer 5 seconds   config.timeout = 10    # don't raise errors when ssl certificates can't validated   config.ignore_ssl_errors  end  capybara.javascript_driver = :webkit  dir[rails.root.join("spec/support/**/*.rb")].each {|f| require f}  rspec.configure |config|   # rspec-expectations config goes here. can use alternate   # assertion/expectation library such wrong or stdlib/minitest   # assertions if prefer.   config.use_transactional_fixtures = false   config.before(:suite)     databasecleaner.clean_with(:truncation)   end    config.before(:each) |example|     databasecleaner.strategy= example.metadata[:js] ? :truncation : :transaction     databasecleaner.start   end    config.after(:each)     databasecleaner.clean   end    config.include signinhelpers, type: :feature   config.mock_with :rspec    config.expect_with :rspec |expectations|     expectations.include_chain_clauses_in_custom_matcher_descriptions = true   end    # rspec-mocks config goes here. can use alternate test double   # library (such bogus or mocha) changing `mock_with` option here.   config.mock_with :rspec |mocks|     # prevents mocking or stubbing method not exist on     # real object. recommended, , default     # `true` in rspec 4.     mocks.verify_partial_doubles = true   end end 

as can see in webkit configure block seting config.allow_unknown_urls , explicitly allowing checkout.stripe.com

when run test uses webkit following warnings:

warning: next major version of capybara-webkit require @ least version 5.0 of qt. you're using version 4.8.7. request unknown url: https://checkout.stripe.com/v3/data/languages/en.json block requests unknown urls:   page.driver.block_unknown_urls allow url:   page.driver.allow_url("https://checkout.stripe.com/v3/data/languages/en.json") allow requests urls host:   page.driver.allow_url("checkout.stripe.com")   buyer creates new event 

this confuses me webkit has been configured allow unknown urls , explicitly checkout.stripe.com. have configured incorrectly here?

i had similar problem , resolved removing js: true test.

i think js: true specifies capybara-webkits js driver instead of default selenium 1 if can default may fix this. (someone please edit if not correct)

that said, i've had lot of trouble reproducing consistently.


Comments