rack-test_server 0.1.5 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6406dd22b7cccbc0b58ecc54464b265ebbdbd4ca006ccc09d736cd5435b66afd
4
- data.tar.gz: 916b218f513afcaea4266c3557ca514b1f39df726ff6bc01e7c9b6511c411b18
3
+ metadata.gz: 335efdff6c7d5e4a5be51002462ca17c92ac11e667011eee6d2b1d21195d555d
4
+ data.tar.gz: e1dbadcb0ecf680e4077ad67e6b796efbe00329de6c75e7aeff0210b1fc03940
5
5
  SHA512:
6
- metadata.gz: 0ef53d8ef4627b0a4883e58743d62addadd1a83fce858eee9ce02ccde12058226410b7ff674e76cbdd21423fc5b8b903aec3f40dec12558d0fda5028cedc8795
7
- data.tar.gz: 47ffe65375c3dbc5c91a08a1286e79f6f35d58d7b78e62180faefa952c85569f3bef71a4a310fba9a8b3b65db8dba6184be6f2e9da4cb0c66243d293bec12c38
6
+ metadata.gz: bb914169d7cbd83015dbf3beb3f14163a514b69f7aa3b27100f567436c27c91d523b4a6292ac3b455e4ddeab85ae3ef5d626cd70216f44058826e0659cebd032
7
+ data.tar.gz: 4443827d97045b7bec5a905ed9991b0c78601bcc66dfea8b1bd94ba6d11b17fb9860bfd93008bb0a3d8d762c8a33c3f050a4cf3dac0c224e9cce53a0414732c6
data/README.md CHANGED
@@ -38,6 +38,8 @@ gem 'rack-test_server'
38
38
 
39
39
  and then `bundle install`.
40
40
 
41
+ NOTE: Ruby 2.3 users can use 0.1.5. (without `rackup` gem), however it is no longer supported.
42
+
41
43
  ## Usage
42
44
 
43
45
  If you are working with Rails application, add configuration like below in spec/support/system_testing_helper.rb:
@@ -47,7 +49,7 @@ require 'rack/test_server'
47
49
 
48
50
  # Configure Rack server
49
51
  #
50
- # options for Rack::Server
52
+ # options for Rackup::Server
51
53
  # @see https://github.com/rack/rack/blob/2.2.3/lib/rack/server.rb#L173
52
54
  # options for Rack::Handler::Puma
53
55
  # @see https://github.com/puma/puma/blob/v5.4.0/lib/rack/handler/puma.rb#L84
@@ -20,12 +20,19 @@ module Rack
20
20
  end
21
21
  end
22
22
 
23
- require 'rack/server'
24
-
25
- # Disable SIGINT handler in Rack::Server.
26
- # https://github.com/rack/rack/blob/2.2.3/lib/rack/server.rb#L319
27
- Rack::Server.prepend(Rack::TestServer::SignalTrapInterceptor)
23
+ begin
24
+ # Disable SIGINT handler in Rackup::Server.
25
+ require 'rackup/server'
26
+ # https://github.com/rack/rackup/blob/main/lib/rackup/server.rb#L333
27
+ Rackup::Server.prepend(Rack::TestServer::SignalTrapInterceptor)
28
+ rescue LoadError
29
+ # Disable SIGINT handler in Rack::Server.
30
+ # https://github.com/rack/rack/blob/2.2.3/lib/rack/server.rb#L319
31
+ require 'rack/server'
32
+ Rack::Server.prepend(Rack::TestServer::SignalTrapInterceptor)
33
+ end
28
34
 
29
35
  # Mainly inteded to disable SIGINT handler in Puma.
30
36
  # https://github.com/puma/puma/blob/v5.5.0/lib/puma/launcher.rb#L485
37
+ # https://github.com/puma/puma/blob/v6.4.2/lib/puma/launcher.rb#L441
31
38
  Signal.singleton_class.prepend(Rack::TestServer::SignalTrapInterceptor)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class TestServer
5
- VERSION = '0.1.5'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ require 'rack/test_server/puma_signal_trap_interceptor'
8
8
  require 'rack/test_server/signal_trap_interceptor'
9
9
 
10
10
  module Rack
11
- # An utility class for launching HTTP server with Rack::Server#start
11
+ # An utility class for launching HTTP server with Rackup::Server#start
12
12
  # and waiting for the server available with checking a healthcheck endpoint with net/http.
13
13
  #
14
14
  # The most typical usage is:
@@ -28,7 +28,11 @@ module Rack
28
28
  end
29
29
  end
30
30
 
31
- @server = Rack::Server.new(app: testapp, **options)
31
+ begin
32
+ @server = Rackup::Server.new(app: testapp, **options)
33
+ rescue NameError
34
+ @server = Rack::Server.new(app: testapp, **options)
35
+ end
32
36
  @host = @server.options[:Host] || @server.default_options[:Host]
33
37
  @port = @server.options[:Port] || @server.default_options[:Port]
34
38
  end
@@ -46,7 +50,7 @@ module Rack
46
50
  #
47
51
  # @note This method will block the thread, and in most cases {#start_async} is suitable.
48
52
  def start
49
- # Disable SIGINT handler in Rack::Server.
53
+ # Disable SIGINT handler in Rackup::Server.
50
54
  # https://github.com/rack/rack/blob/2.2.3/lib/rack/server.rb#L319
51
55
  SignalTrapInterceptor.enable
52
56
  @server.start do |server|
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.required_ruby_version = '>= 2.3'
27
- spec.add_dependency 'rack', '>= 2', '< 3'
26
+ spec.required_ruby_version = '>= 2.4'
27
+ spec.add_dependency 'rack'
28
+ spec.add_dependency 'rackup'
28
29
  spec.add_development_dependency 'minitest'
29
30
  spec.add_development_dependency 'puma'
30
31
  spec.add_development_dependency 'rake'
31
32
  spec.add_development_dependency 'sinatra'
32
- spec.add_development_dependency 'thin'
33
33
  spec.add_development_dependency 'webrick'
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-test_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-17 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,28 +16,22 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3'
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3'
26
+ version: '0'
33
27
  - !ruby/object:Gem::Dependency
34
- name: minitest
28
+ name: rackup
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: '0'
40
- type: :development
34
+ type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
@@ -45,7 +39,7 @@ dependencies:
45
39
  - !ruby/object:Gem::Version
46
40
  version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
- name: puma
42
+ name: minitest
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - ">="
@@ -59,7 +53,7 @@ dependencies:
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
55
  - !ruby/object:Gem::Dependency
62
- name: rake
56
+ name: puma
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - ">="
@@ -73,7 +67,7 @@ dependencies:
73
67
  - !ruby/object:Gem::Version
74
68
  version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
- name: sinatra
70
+ name: rake
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - ">="
@@ -87,7 +81,7 @@ dependencies:
87
81
  - !ruby/object:Gem::Version
88
82
  version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
- name: thin
84
+ name: sinatra
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - ">="
@@ -146,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
140
  requirements:
147
141
  - - ">="
148
142
  - !ruby/object:Gem::Version
149
- version: '2.3'
143
+ version: '2.4'
150
144
  required_rubygems_version: !ruby/object:Gem::Requirement
151
145
  requirements:
152
146
  - - ">="