diff options
Diffstat (limited to 'actionsystemtest/lib')
-rw-r--r-- | actionsystemtest/lib/action_system_test.rb | 21 | ||||
-rw-r--r-- | actionsystemtest/lib/action_system_test/server.rb | 19 |
2 files changed, 14 insertions, 26 deletions
diff --git a/actionsystemtest/lib/action_system_test.rb b/actionsystemtest/lib/action_system_test.rb index d28e30d116..3c96361725 100644 --- a/actionsystemtest/lib/action_system_test.rb +++ b/actionsystemtest/lib/action_system_test.rb @@ -71,16 +71,16 @@ module ActionSystemTest # :nodoc: # end # # By default, <tt>ActionSystemTest</tt> is driven by the Selenium driver, with - # the Chrome browser, on port 21800, and a browser size of 1400x1400. + # the Chrome browser, and a browser size of 1400x1400. # # Changing the driver configuration options are easy. Let's say you want to use - # port 3000, and the Firefox browser instead. In your +system_test_helper.rb+ + # and the Firefox browser instead. In your +system_test_helper.rb+ # file add the following: # # require "test_helper" # # class ActionSystemTestCase < ActionSystemTest::Base - # driven_by :selenium, using: :firefox, on: 3000 + # driven_by :selenium, using: :firefox # # teardown do # take_failed_screenshot @@ -90,8 +90,7 @@ module ActionSystemTest # :nodoc: # # +driven_by+ has a required argument for the driver name. The keyword # arguments are +:using+ for the browser (not applicable for headless drivers), - # +:on+ for port (the server is always Puma), and +:screen_size+ to change - # the size of the screen when taking screenshots. + # and +:screen_size+ to change the size of the screen taking screenshots. # # To use a headless driver, like Poltergeist, update your Gemfile to use # Poltergeist instead of Selenium and then declare the driver name in the @@ -129,17 +128,19 @@ module ActionSystemTest # :nodoc: # Action System Test configuration options # - # The defaults settings are Selenium, using Chrome, on port 21800, with a - # screen size of 1400x1400. + # The defaults settings are Selenium, using Chrome, with a screen size + # of 1400x1400. # # Examples: # # driven_by :poltergeist # - # driven_by :selenium, using: :firefox, on: 3000 - def self.driven_by(driver, using: :chrome, on: 21800, screen_size: [1400, 1400]) + # driven_by :selenium, using: :firefox + # + # driven_by :selenium, screen_size: [800, 800] + def self.driven_by(driver, using: :chrome, screen_size: [1400, 1400]) Driver.new(driver).run - Server.new(on).run + Server.new.run Browser.new(using, screen_size).run if selenium?(driver) end diff --git a/actionsystemtest/lib/action_system_test/server.rb b/actionsystemtest/lib/action_system_test/server.rb index 6f87b2767d..76ae30f753 100644 --- a/actionsystemtest/lib/action_system_test/server.rb +++ b/actionsystemtest/lib/action_system_test/server.rb @@ -2,10 +2,6 @@ require "rack/handler/puma" module ActionSystemTest class Server # :nodoc: - def initialize(port) - @port = port - end - def run register setup @@ -13,22 +9,13 @@ module ActionSystemTest private def register - Capybara.register_server :puma do |app, host| - Rack::Handler::Puma.run(app, Port: @port, Threads: "0:1") + Capybara.register_server :rails_puma do |app, port, host| + Rack::Handler::Puma.run(app, Port: port, Threads: "0:1") end end def setup - set_server - set_port - end - - def set_server - Capybara.server = :puma - end - - def set_port - Capybara.server_port = @port + Capybara.server = :rails_puma end end end |