Files
openfoodnetwork/spec/system/billy_spec.rb
Maikel Linke a062a7b697 Add Billy proxy to Chrome in system specs
And demonstrate the use of puffing-billy browser proxy.

Billy can cache and record responses to browser requests. For that to
work we need to allow network connections and disable VCR. But instead I
found that the Billy proxy is just like any other Ruby backend code and
its connections can be recorded with VCR instead.

And instead of stubbing requests via Billy.proxy, we can use standard
Webmock `stub_request`. Now we use puffing-billy just to relay browser
requests via our Ruby app.
2025-07-29 14:37:27 +10:00

22 lines
587 B
Ruby

# frozen_string_literal: true
require 'system_helper'
RSpec.describe "Testing external scripts loaded in the browser" do
it "loads a website", :vcr do
visit "http://deb.debian.org:80/debian/"
expect(page).to have_content "Debian Archive"
end
it "handles HTTPS", :vcr do
visit "https://deb.debian.org:443/debian/"
expect(page).to have_content "Debian Archive"
end
it "stubs content" do
stub_request(:get, "https://deb.debian.org:443").to_return(body: "stubbed")
visit "https://deb.debian.org:443"
expect(page).to have_content "stubbed"
end
end