I'm trying to setup puffing-billy to work with Rails System Test. Since it uses Capybara for that, I tried all the documented Capybara solutions here, but didn't seem to get it correctly setup.
System Test generates an application_system_test_case.rb
for config stuff. Here's how it looks like:
require "test_helper"
require 'billy'
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
Capybara.javascript_driver = :selenium_chrome_billy
Capybara.current_driver = Capybara.javascript_driver
WebMock.allow_net_connect!
end
And the actual test file looks like this:
require "application_system_test_case"
class PromotionsTest < ApplicationSystemTestCase
include ApplicationHelper
make_my_diffs_pretty!
Capybara.default_max_wait_time = 3
Capybara.configure do |config|
config.app_host = "http://dev.myapp.com"
end
test 'Stub test' do
proxy.stub('http://www.google.com/').and_return(:text => "I'm not Google!")
visit 'http://www.google.com/'
end
end
But then when I run the tests:
NameError: undefined local variable or method 'proxy' for #<PromotionsTest:0x00007fd357450c90>
.
What am I doing wrong here?