Skip to content

Commit

Permalink
Merge pull request #30638 from twalpole/capybara_server
Browse files Browse the repository at this point in the history
Use the default Capybara registered puma server configuration
  • Loading branch information
eileencodes committed Sep 18, 2017
2 parents e4017d0 + ba04b58 commit 42d09f6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -15,7 +15,7 @@ gem "rake", ">= 11.1"
# be loaded after loading the test library. # be loaded after loading the test library.
gem "mocha", "~> 0.14", require: false gem "mocha", "~> 0.14", require: false


gem "capybara", "~> 2.13" gem "capybara", "~> 2.15"


gem "rack-cache", "~> 1.2" gem "rack-cache", "~> 1.2"
gem "jquery-rails" gem "jquery-rails"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -490,7 +490,7 @@ DEPENDENCIES
blade-sauce_labs_plugin blade-sauce_labs_plugin
bootsnap (>= 1.1.0) bootsnap (>= 1.1.0)
byebug byebug
capybara (~> 2.13) capybara (~> 2.15)
coffee-rails coffee-rails
dalli (>= 2.2.1) dalli (>= 2.2.1)
delayed_job delayed_job
Expand Down
7 changes: 7 additions & 0 deletions actionpack/CHANGELOG.md
@@ -1,3 +1,10 @@
* Use Capybara registered `:puma` server config.

The Capybara registered `:puma` server ensures the puma server is run in process so
connection sharing and open request detection work correctly by default.

*Thomas Walpole*

* Cookies `:expires` option supports `ActiveSupport::Duration` object. * Cookies `:expires` option supports `ActiveSupport::Duration` object.


cookies[:user_name] = { value: "assain", expires: 1.hour } cookies[:user_name] = { value: "assain", expires: 1.hour }
Expand Down
14 changes: 1 addition & 13 deletions actionpack/lib/action_dispatch/system_testing/server.rb
Expand Up @@ -12,29 +12,17 @@ class << self
self.silence_puma = false self.silence_puma = false


def run def run
register
setup setup
end end


private private
def register
Capybara.register_server :rails_puma do |app, port, host|
Rack::Handler::Puma.run(
app,
Port: port,
Threads: "0:1",
Silent: self.class.silence_puma
)
end
end

def setup def setup
set_server set_server
set_port set_port
end end


def set_server def set_server
Capybara.server = :rails_puma Capybara.server = :puma, { Silent: self.class.silence_puma }
end end


def set_port def set_port
Expand Down
4 changes: 0 additions & 4 deletions actionpack/test/dispatch/system_testing/server_test.rb
Expand Up @@ -9,10 +9,6 @@ class ServerTest < ActiveSupport::TestCase
ActionDispatch::SystemTesting::Server.new.run ActionDispatch::SystemTesting::Server.new.run
end end


test "initializing the server port" do
assert_includes Capybara.servers, :rails_puma
end

test "port is always included" do test "port is always included" do
assert Capybara.always_include_port, "expected Capybara.always_include_port to be true" assert Capybara.always_include_port, "expected Capybara.always_include_port to be true"
end end
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/rails/app/templates/Gemfile
Expand Up @@ -41,7 +41,7 @@ group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
<%- if depends_on_system_test? -%> <%- if depends_on_system_test? -%>
# Adds support for Capybara system testing and selenium driver # Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13' gem 'capybara', '~> 2.15'
gem 'selenium-webdriver' gem 'selenium-webdriver'
<%- end -%> <%- end -%>
end end
Expand Down

0 comments on commit 42d09f6

Please sign in to comment.