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

Does puffing billy work with System Test? #269

Closed kayo-campos closed 2 years ago

kayo-campos commented 5 years ago

I'm new to testing stuff with Rails and I had to mock some browser requisitions (such as images), then I found puffing-billy but couldn't find how to set it up with System Test in the docs. Does it work with System Test?

ronwsmith commented 5 years ago

I'm not familiar with System Test. Puffing-billy is implemented as a browser proxy so it should work as long as the driver supports adding proxy configuration. You can use the Billy proxy directly in your driver config using Billy.proxy.host and Billy.proxy.port and see if it works.

kayo-campos commented 5 years ago

I'm working on another feature on the code that does not need puffing-billy to be tested, but as soon as I get time I'll try to setup System Test to work with puffing-billy and give an update to this issue. Thanks a lot!

theomelo commented 4 years ago

It didn't work for me as system test, only with feature tests. I ended up creating a custom example group to set all the specifics for puffing_billy though.

# spec/support/example_groups/puffing_billy_example_group.rb

module PuffingBillyExampleGroup
    extend ActiveSupport::Concern
    RSpec.configure do |config|
         config.include self, type: :puffing_billy
         config.include Capybara::DSL, type: :puffing_billy
         config.include Capybara::RSpecMatchers, type: :puffing_billy

         #other config specifics      
    end
end

and then

RSpec.describe 'Custom test', type: :puffing_billy do
    # things
end
jtoy commented 4 years ago

im running into he same issue, has anyone got this to work?

ronwsmith commented 2 years ago

Stale issue, closing. Feel free to reopen if this is still desired.