jeudi 26 juillet 2018

Blacklist URLs with headless Chrome

I'm trying to block URLs in my specs, achieving something like I had when using capybara_webkit:

Capybara::Webkit.configure do |config|
  config.block_url("*google*")
  config.allow_url('*my_website.com')
end

After reading this article, I tried to do something like:

require 'webmock/rspec'

module WebmockConfig
  def self.default_disabled_urls
    [
      '*google*'
    ]
  end
end

WebMock.disable_net_connect!(allow_localhost: true)
WebMock.disable_net_connect!(allow: WebmockConfig.default_disabled_urls)

with no results. What's wrong?

Aucun commentaire:

Enregistrer un commentaire