1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #41467 from fredplante/improve-rack-test-integration

Improve rack_test integration for system tests
This commit is contained in:
Rafael França 2021-02-17 10:04:40 -05:00 committed by GitHub
commit 983a50da87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -24,7 +24,7 @@ module ActionDispatch
private
def registerable?
[:selenium, :poltergeist, :webkit].include?(@name)
[:selenium, :poltergeist, :webkit, :rack_test].include?(@name)
end
def register
@ -35,6 +35,7 @@ module ActionDispatch
when :selenium then register_selenium(app)
when :poltergeist then register_poltergeist(app)
when :webkit then register_webkit(app)
when :rack_test then register_rack_test(app)
end
end
end
@ -59,6 +60,10 @@ module ActionDispatch
end
end
def register_rack_test(app)
Capybara::RackTest::Driver.new(app, { respect_data_method: true }.merge(@options))
end
def setup
Capybara.current_driver = @name
end

View file

@ -51,10 +51,6 @@ class DriverTest < ActiveSupport::TestCase
assert_equal ({ skip_image_loading: true }), driver.instance_variable_get(:@options)
end
test "registerable? returns false if driver is rack_test" do
assert_not ActionDispatch::SystemTesting::Driver.new(:rack_test).send(:registerable?)
end
test "define extra capabilities using chrome" do
driver = ActionDispatch::SystemTesting::Driver.new(:selenium, screen_size: [1400, 1400], using: :chrome) do |option|
option.add_argument("start-maximized")