actionpack 6.0.0 → 6.0.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8db1d871d96c2bc367142553c0904b94c3d97016dabf79b4a6b8937bca18936
4
- data.tar.gz: 667375200f2d159a53b70dbf607d35c37422e4289dbede8ff83da7cebad95f47
3
+ metadata.gz: 712053e56e990a145430653396c17ec95d5e838da7243b209cb340426c00e949
4
+ data.tar.gz: f6fc9d43ab2813011edd135cdb4d21dae7499fe66cef41e146c17c941d93edbe
5
5
  SHA512:
6
- metadata.gz: e19317e121515e9866836182682c94f5d71f9d70236c710a41680ae9caa4b2376f888e975ff287a6cbb1f187547c59e9f7583ab410a2f437a01b2a57abf725c1
7
- data.tar.gz: 21557eab0cd33607cbbd3e020d2dae220df079be98ccdeca0e93340824801f695a01fb882de686d9eddddeb2eaf5d165eec64d2eaa40981537baa8379bb98cc3
6
+ metadata.gz: 1a5e6e7326f7d15187bcfcaebe72e02182ee7ee8454a5b2aac54adc9a8017dd80eebd4152d74f7ee6c5c0861f8ce87a1254f342bdea6b2760a66aab50ffdc639
7
+ data.tar.gz: 8b907a4c8c860951d3a7b04a3c353e05601c8d996f3d7448aaec30ba82c83c48595a752381eef44a1ed559c975835eb9557fe97c0c8e89f942d897afa3062680
@@ -1,3 +1,20 @@
1
+ ## Rails 6.0.1.rc1 (October 31, 2019) ##
2
+
3
+ * `ActionDispatch::SystemTestCase` now inherits from `ActiveSupport::TestCase`
4
+ rather than `ActionDispatch::IntegrationTest`. This permits running jobs in
5
+ system tests.
6
+
7
+ *George Claghorn*, *Edouard Chin*
8
+
9
+ * Registered MIME types may contain extra flags:
10
+
11
+ ```ruby
12
+ Mime::Type.register "text/html; fragment", :html_fragment
13
+ ```
14
+
15
+ *Aaron Patterson*
16
+
17
+
1
18
  ## Rails 6.0.0 (August 16, 2019) ##
2
19
 
3
20
  * No changes.
@@ -3,7 +3,6 @@
3
3
  require "active_support/rails"
4
4
  require "abstract_controller"
5
5
  require "action_dispatch"
6
- require "action_controller/metal/live"
7
6
  require "action_controller/metal/strong_parameters"
8
7
 
9
8
  module ActionController
@@ -21,6 +20,10 @@ module ActionController
21
20
  end
22
21
 
23
22
  autoload_under "metal" do
23
+ eager_autoload do
24
+ autoload :Live
25
+ end
26
+
24
27
  autoload :ConditionalGet
25
28
  autoload :ContentSecurityPolicy
26
29
  autoload :Cookies
@@ -27,7 +27,7 @@ module ActionController
27
27
 
28
28
  class MethodNotAllowed < ActionControllerError #:nodoc:
29
29
  def initialize(*allowed_methods)
30
- super("Only #{allowed_methods.to_sentence(locale: :en)} requests are allowed.")
30
+ super("Only #{allowed_methods.to_sentence} requests are allowed.")
31
31
  end
32
32
  end
33
33
 
@@ -115,7 +115,7 @@ module ActionController
115
115
 
116
116
  if m.respond_to?(:nested_attributes_options) && m.nested_attributes_options.keys.any?
117
117
  self.include += m.nested_attributes_options.keys.map do |key|
118
- key.to_s.concat("_attributes")
118
+ (+key.to_s).concat("_attributes")
119
119
  end
120
120
  end
121
121
 
@@ -457,6 +457,7 @@ module ActionController
457
457
  def process(action, method: "GET", params: nil, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
458
458
  check_required_ivars
459
459
 
460
+ action = +action.to_s
460
461
  http_method = method.to_s.upcase
461
462
 
462
463
  @html_document = nil
@@ -488,11 +489,11 @@ module ActionController
488
489
  parameters[:format] = format
489
490
  end
490
491
 
491
- generated_extras = @routes.generate_extras(parameters.merge(controller: controller_class_name, action: action.to_s))
492
+ generated_extras = @routes.generate_extras(parameters.merge(controller: controller_class_name, action: action))
492
493
  generated_path = generated_path(generated_extras)
493
494
  query_string_keys = query_parameter_names(generated_extras)
494
495
 
495
- @request.assign_parameters(@routes, controller_class_name, action.to_s, parameters, generated_path, query_string_keys)
496
+ @request.assign_parameters(@routes, controller_class_name, action, parameters, generated_path, query_string_keys)
496
497
 
497
498
  @request.session.update(session) if session
498
499
  @request.flash.update(flash || {})
@@ -82,7 +82,6 @@ module ActionDispatch # :nodoc:
82
82
  SET_COOKIE = "Set-Cookie"
83
83
  LOCATION = "Location"
84
84
  NO_CONTENT_CODES = [100, 101, 102, 204, 205, 304]
85
- CONTENT_TYPE_PARSER = /\A(?<type>[^;\s]+)?(?:.*;\s*charset=(?<quote>"?)(?<charset>[^;\s]+)\k<quote>)?/ # :nodoc:
86
85
 
87
86
  cattr_accessor :default_charset, default: "utf-8"
88
87
  cattr_accessor :default_headers
@@ -420,13 +419,18 @@ module ActionDispatch # :nodoc:
420
419
  end
421
420
 
422
421
  private
423
-
424
422
  ContentTypeHeader = Struct.new :mime_type, :charset
425
423
  NullContentTypeHeader = ContentTypeHeader.new nil, nil
426
424
 
425
+ CONTENT_TYPE_PARSER = /
426
+ \A
427
+ (?<mime_type>[^;\s]+\s*(?:;\s*(?:(?!charset)[^;\s])+)*)?
428
+ (?:;\s*charset=(?<quote>"?)(?<charset>[^;\s]+)\k<quote>)?
429
+ /x # :nodoc:
430
+
427
431
  def parse_content_type(content_type)
428
432
  if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
429
- ContentTypeHeader.new(match[:type], match[:charset])
433
+ ContentTypeHeader.new(match[:mime_type], match[:charset])
430
434
  else
431
435
  NullContentTypeHeader
432
436
  end
@@ -531,4 +535,6 @@ module ActionDispatch # :nodoc:
531
535
  end
532
536
  end
533
537
  end
538
+
539
+ ActiveSupport.run_load_hooks(:action_dispatch_response, Response)
534
540
  end
@@ -8,13 +8,13 @@ module ActionDispatch
8
8
  # contain the address, and then picking the last-set address that is not
9
9
  # on the list of trusted IPs. This follows the precedent set by e.g.
10
10
  # {the Tomcat server}[https://issues.apache.org/bugzilla/show_bug.cgi?id=50453],
11
- # with {reasoning explained at length}[http://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection]
11
+ # with {reasoning explained at length}[https://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection]
12
12
  # by @gingerlime. A more detailed explanation of the algorithm is given
13
13
  # at GetIp#calculate_ip.
14
14
  #
15
15
  # Some Rack servers concatenate repeated headers, like {HTTP RFC 2616}[https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2]
16
16
  # requires. Some Rack servers simply drop preceding headers, and only report
17
- # the value that was {given in the last header}[http://andre.arko.net/2011/12/26/repeated-headers-and-ruby-web-servers].
17
+ # the value that was {given in the last header}[https://andre.arko.net/2011/12/26/repeated-headers-and-ruby-web-servers].
18
18
  # If you are behind multiple proxy servers (like NGINX to HAProxy to Unicorn)
19
19
  # then you should test your Rack server to make sure your data is good.
20
20
  #
@@ -102,7 +102,7 @@ module ActionDispatch
102
102
  # proxies, that header may contain a list of IPs. Other proxy services
103
103
  # set the Client-Ip header instead, so we check that too.
104
104
  #
105
- # As discussed in {this post about Rails IP Spoofing}[http://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection/],
105
+ # As discussed in {this post about Rails IP Spoofing}[https://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection/],
106
106
  # while the first IP in the list is likely to be the "originating" IP,
107
107
  # it could also have been set by the client maliciously.
108
108
  #
@@ -42,9 +42,11 @@ module ActionDispatch
42
42
  ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length
43
43
  ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header
44
44
  ActionDispatch::Request::Utils.perform_deep_munge = app.config.action_dispatch.perform_deep_munge
45
- ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding
46
- ActionDispatch::Response.default_headers = app.config.action_dispatch.default_headers
47
- ActionDispatch::Response.return_only_media_type_on_content_type = app.config.action_dispatch.return_only_media_type_on_content_type
45
+ ActiveSupport.on_load(:action_dispatch_response) do
46
+ self.default_charset = app.config.action_dispatch.default_charset || app.config.encoding
47
+ self.default_headers = app.config.action_dispatch.default_headers
48
+ self.return_only_media_type_on_content_type = app.config.action_dispatch.return_only_media_type_on_content_type
49
+ end
48
50
 
49
51
  ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
50
52
  ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)
@@ -2074,7 +2074,7 @@ module ActionDispatch
2074
2074
  # of routing helpers, e.g:
2075
2075
  #
2076
2076
  # direct :homepage do
2077
- # "http://www.rubyonrails.org"
2077
+ # "https://rubyonrails.org"
2078
2078
  # end
2079
2079
  #
2080
2080
  # direct :commentable do |model|
@@ -11,7 +11,6 @@ require "action_dispatch/system_testing/browser"
11
11
  require "action_dispatch/system_testing/server"
12
12
  require "action_dispatch/system_testing/test_helpers/screenshot_helper"
13
13
  require "action_dispatch/system_testing/test_helpers/setup_and_teardown"
14
- require "action_dispatch/system_testing/test_helpers/undef_methods"
15
14
 
16
15
  module ActionDispatch
17
16
  # = System Testing
@@ -111,16 +110,26 @@ module ActionDispatch
111
110
  # Because <tt>ActionDispatch::SystemTestCase</tt> is a shim between Capybara
112
111
  # and Rails, any driver that is supported by Capybara is supported by system
113
112
  # tests as long as you include the required gems and files.
114
- class SystemTestCase < IntegrationTest
113
+ class SystemTestCase < ActiveSupport::TestCase
115
114
  include Capybara::DSL
116
115
  include Capybara::Minitest::Assertions
117
116
  include SystemTesting::TestHelpers::SetupAndTeardown
118
117
  include SystemTesting::TestHelpers::ScreenshotHelper
119
- include SystemTesting::TestHelpers::UndefMethods
120
118
 
121
119
  def initialize(*) # :nodoc:
122
120
  super
123
121
  self.class.driver.use
122
+ @proxy_route = if ActionDispatch.test_app
123
+ Class.new do
124
+ include ActionDispatch.test_app.routes.url_helpers
125
+
126
+ def url_options
127
+ default_url_options.merge(host: Capybara.app_host)
128
+ end
129
+ end.new
130
+ else
131
+ nil
132
+ end
124
133
  end
125
134
 
126
135
  def self.start_application # :nodoc:
@@ -161,6 +170,14 @@ module ActionDispatch
161
170
 
162
171
  driven_by :selenium
163
172
 
173
+ def method_missing(method, *args, &block)
174
+ if @proxy_route.respond_to?(method)
175
+ @proxy_route.send(method, *args, &block)
176
+ else
177
+ super
178
+ end
179
+ end
180
+
164
181
  ActiveSupport.run_load_hooks(:action_dispatch_system_test_case, self)
165
182
  end
166
183
 
@@ -7,7 +7,6 @@ module ActionDispatch
7
7
  DEFAULT_HOST = "http://127.0.0.1"
8
8
 
9
9
  def host!(host)
10
- super
11
10
  Capybara.app_host = host
12
11
  end
13
12
 
@@ -9,8 +9,8 @@ module ActionPack
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 0
13
- PRE = nil
12
+ TINY = 1
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2019-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.0
19
+ version: 6.0.1.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.0
26
+ version: 6.0.1.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.0
95
+ version: 6.0.1.rc1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 6.0.0
102
+ version: 6.0.1.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 6.0.0
109
+ version: 6.0.1.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 6.0.0
116
+ version: 6.0.1.rc1
117
117
  description: Web apps on Rails. Simple, battle-tested conventions for building and
118
118
  testing MVC web applications. Works with any Rack-compatible server.
119
119
  email: david@loudthinking.com
@@ -287,7 +287,6 @@ files:
287
287
  - lib/action_dispatch/system_testing/server.rb
288
288
  - lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
289
289
  - lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb
290
- - lib/action_dispatch/system_testing/test_helpers/undef_methods.rb
291
290
  - lib/action_dispatch/testing/assertion_response.rb
292
291
  - lib/action_dispatch/testing/assertions.rb
293
292
  - lib/action_dispatch/testing/assertions/response.rb
@@ -304,8 +303,11 @@ homepage: https://rubyonrails.org
304
303
  licenses:
305
304
  - MIT
306
305
  metadata:
307
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0/actionpack
308
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0/actionpack/CHANGELOG.md
306
+ bug_tracker_uri: https://github.com/rails/rails/issues
307
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.1.rc1/actionpack/CHANGELOG.md
308
+ documentation_uri: https://api.rubyonrails.org/v6.0.1.rc1/
309
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
310
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.1.rc1/actionpack
309
311
  post_install_message:
310
312
  rdoc_options: []
311
313
  require_paths:
@@ -317,12 +319,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
319
  version: 2.5.0
318
320
  required_rubygems_version: !ruby/object:Gem::Requirement
319
321
  requirements:
320
- - - ">="
322
+ - - ">"
321
323
  - !ruby/object:Gem::Version
322
- version: '0'
324
+ version: 1.3.1
323
325
  requirements:
324
326
  - none
325
- rubygems_version: 3.0.1
327
+ rubygems_version: 3.0.3
326
328
  signing_key:
327
329
  specification_version: 4
328
330
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionDispatch
4
- module SystemTesting
5
- module TestHelpers
6
- module UndefMethods # :nodoc:
7
- extend ActiveSupport::Concern
8
- included do
9
- METHODS = %i(get post put patch delete).freeze
10
-
11
- METHODS.each do |verb|
12
- undef_method verb
13
- end
14
-
15
- def method_missing(method, *args, &block)
16
- if METHODS.include?(method)
17
- raise NoMethodError, "System tests cannot make direct requests via ##{method}; use #visit and #click_on instead. See http://www.rubydoc.info/github/teamcapybara/capybara/master#The_DSL for more information."
18
- else
19
- super
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end