actionpack 6.1.7.5 → 7.0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +323 -399
- data/MIT-LICENSE +1 -0
- data/README.rdoc +4 -5
- data/lib/abstract_controller/asset_paths.rb +1 -1
- data/lib/abstract_controller/base.rb +13 -26
- data/lib/abstract_controller/caching/fragments.rb +2 -2
- data/lib/abstract_controller/caching.rb +1 -1
- data/lib/abstract_controller/callbacks.rb +21 -7
- data/lib/abstract_controller/collector.rb +2 -2
- data/lib/abstract_controller/error.rb +1 -1
- data/lib/abstract_controller/helpers.rb +17 -12
- data/lib/abstract_controller/logger.rb +1 -1
- data/lib/abstract_controller/railties/routes_helpers.rb +2 -0
- data/lib/abstract_controller/rendering.rb +9 -11
- data/lib/abstract_controller/translation.rb +27 -4
- data/lib/abstract_controller/url_for.rb +4 -6
- data/lib/action_controller/api.rb +7 -7
- data/lib/action_controller/base.rb +5 -4
- data/lib/action_controller/form_builder.rb +2 -2
- data/lib/action_controller/log_subscriber.rb +4 -3
- data/lib/action_controller/metal/basic_implicit_render.rb +3 -1
- data/lib/action_controller/metal/conditional_get.rb +137 -102
- data/lib/action_controller/metal/content_security_policy.rb +36 -2
- data/lib/action_controller/metal/cookies.rb +1 -1
- data/lib/action_controller/metal/data_streaming.rb +23 -31
- data/lib/action_controller/metal/etag_with_flash.rb +1 -1
- data/lib/action_controller/metal/exceptions.rb +19 -30
- data/lib/action_controller/metal/flash.rb +6 -2
- data/lib/action_controller/metal/head.rb +1 -1
- data/lib/action_controller/metal/helpers.rb +2 -2
- data/lib/action_controller/metal/http_authentication.rb +66 -39
- data/lib/action_controller/metal/instrumentation.rb +57 -52
- data/lib/action_controller/metal/live.rb +43 -2
- data/lib/action_controller/metal/mime_responds.rb +3 -3
- data/lib/action_controller/metal/params_wrapper.rb +20 -11
- data/lib/action_controller/metal/permissions_policy.rb +19 -28
- data/lib/action_controller/metal/redirecting.rb +95 -22
- data/lib/action_controller/metal/renderers.rb +12 -13
- data/lib/action_controller/metal/rendering.rb +121 -9
- data/lib/action_controller/metal/request_forgery_protection.rb +83 -32
- data/lib/action_controller/metal/rescue.rb +5 -4
- data/lib/action_controller/metal/streaming.rb +7 -9
- data/lib/action_controller/metal/strong_parameters.rb +138 -115
- data/lib/action_controller/metal/testing.rb +9 -2
- data/lib/action_controller/metal/url_for.rb +3 -5
- data/lib/action_controller/metal.rb +10 -13
- data/lib/action_controller/railtie.rb +50 -6
- data/lib/action_controller/renderer.rb +1 -20
- data/lib/action_controller/test_case.rb +28 -7
- data/lib/action_controller.rb +2 -5
- data/lib/action_dispatch/http/cache.rb +20 -13
- data/lib/action_dispatch/http/content_security_policy.rb +113 -36
- data/lib/action_dispatch/http/filter_parameters.rb +4 -19
- data/lib/action_dispatch/http/headers.rb +1 -1
- data/lib/action_dispatch/http/mime_negotiation.rb +15 -5
- data/lib/action_dispatch/http/mime_type.rb +9 -11
- data/lib/action_dispatch/http/parameters.rb +5 -5
- data/lib/action_dispatch/http/permissions_policy.rb +17 -1
- data/lib/action_dispatch/http/request.rb +27 -37
- data/lib/action_dispatch/http/response.rb +3 -20
- data/lib/action_dispatch/http/upload.rb +13 -2
- data/lib/action_dispatch/http/url.rb +11 -19
- data/lib/action_dispatch/journey/gtg/builder.rb +11 -12
- data/lib/action_dispatch/journey/gtg/simulator.rb +10 -4
- data/lib/action_dispatch/journey/gtg/transition_table.rb +77 -21
- data/lib/action_dispatch/journey/nodes/node.rb +70 -5
- data/lib/action_dispatch/journey/path/pattern.rb +22 -13
- data/lib/action_dispatch/journey/route.rb +6 -13
- data/lib/action_dispatch/journey/router/utils.rb +2 -2
- data/lib/action_dispatch/journey/router.rb +1 -1
- data/lib/action_dispatch/journey/routes.rb +3 -3
- data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
- data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
- data/lib/action_dispatch/middleware/actionable_exceptions.rb +0 -1
- data/lib/action_dispatch/middleware/cookies.rb +20 -13
- data/lib/action_dispatch/middleware/debug_exceptions.rb +6 -4
- data/lib/action_dispatch/middleware/debug_locks.rb +3 -3
- data/lib/action_dispatch/middleware/exception_wrapper.rb +4 -0
- data/lib/action_dispatch/middleware/executor.rb +3 -0
- data/lib/action_dispatch/middleware/flash.rb +17 -18
- data/lib/action_dispatch/middleware/host_authorization.rb +13 -17
- data/lib/action_dispatch/middleware/remote_ip.rb +20 -8
- data/lib/action_dispatch/middleware/request_id.rb +3 -3
- data/lib/action_dispatch/middleware/server_timing.rb +76 -0
- data/lib/action_dispatch/middleware/session/abstract_store.rb +1 -1
- data/lib/action_dispatch/middleware/session/cookie_store.rb +9 -9
- data/lib/action_dispatch/middleware/show_exceptions.rb +17 -16
- data/lib/action_dispatch/middleware/stack.rb +27 -9
- data/lib/action_dispatch/middleware/static.rb +5 -9
- data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +4 -11
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +10 -5
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +7 -3
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +28 -18
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +22 -22
- data/lib/action_dispatch/railtie.rb +8 -2
- data/lib/action_dispatch/request/session.rb +43 -13
- data/lib/action_dispatch/routing/inspector.rb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +82 -83
- data/lib/action_dispatch/routing/redirection.rb +5 -2
- data/lib/action_dispatch/routing/route_set.rb +17 -7
- data/lib/action_dispatch/routing/routes_proxy.rb +1 -1
- data/lib/action_dispatch/routing/url_for.rb +24 -25
- data/lib/action_dispatch/routing.rb +5 -6
- data/lib/action_dispatch/system_test_case.rb +5 -5
- data/lib/action_dispatch/system_testing/browser.rb +3 -13
- data/lib/action_dispatch/system_testing/driver.rb +34 -10
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +11 -7
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +0 -8
- data/lib/action_dispatch/testing/assertions/response.rb +1 -1
- data/lib/action_dispatch/testing/assertions/routing.rb +3 -2
- data/lib/action_dispatch/testing/assertions.rb +2 -5
- data/lib/action_dispatch/testing/integration.rb +6 -8
- data/lib/action_dispatch/testing/test_process.rb +3 -29
- data/lib/action_dispatch/testing/test_response.rb +20 -2
- data/lib/action_dispatch.rb +1 -0
- data/lib/action_pack/gem_version.rb +5 -5
- data/lib/action_pack/version.rb +1 -1
- metadata +16 -15
@@ -72,8 +72,8 @@ module ActionDispatch
|
|
72
72
|
# Headless browsers such as headless Chrome and headless Firefox are also supported.
|
73
73
|
# You can use these browsers by setting the +:using+ argument to +:headless_chrome+ or +:headless_firefox+.
|
74
74
|
#
|
75
|
-
# To use a headless driver, like
|
76
|
-
#
|
75
|
+
# To use a headless driver, like Cuprite, update your Gemfile to use
|
76
|
+
# Cuprite instead of Selenium and then declare the driver name in the
|
77
77
|
# +application_system_test_case.rb+ file. In this case, you would leave out
|
78
78
|
# the +:using+ option because the driver is headless, but you can still use
|
79
79
|
# +:screen_size+ to change the size of the browser screen, also you can use
|
@@ -81,10 +81,10 @@ module ActionDispatch
|
|
81
81
|
# driver documentation to learn about supported options.
|
82
82
|
#
|
83
83
|
# require "test_helper"
|
84
|
-
# require "capybara/
|
84
|
+
# require "capybara/cuprite"
|
85
85
|
#
|
86
86
|
# class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
87
|
-
# driven_by :
|
87
|
+
# driven_by :cuprite, screen_size: [1400, 1400], options:
|
88
88
|
# { js_errors: true }
|
89
89
|
# end
|
90
90
|
#
|
@@ -142,7 +142,7 @@ module ActionDispatch
|
|
142
142
|
#
|
143
143
|
# Examples:
|
144
144
|
#
|
145
|
-
# driven_by :
|
145
|
+
# driven_by :cuprite
|
146
146
|
#
|
147
147
|
# driven_by :selenium, screen_size: [800, 800]
|
148
148
|
#
|
@@ -26,26 +26,16 @@ module ActionDispatch
|
|
26
26
|
yield options if block_given? && options
|
27
27
|
end
|
28
28
|
|
29
|
-
# driver_path can be configured as a proc.
|
29
|
+
# driver_path can be configured as a proc.
|
30
30
|
# proc to update web drivers. Running this proc early allows us to only
|
31
31
|
# update the webdriver once and avoid race conditions when using
|
32
32
|
# parallel tests.
|
33
33
|
def preload
|
34
34
|
case type
|
35
35
|
when :chrome
|
36
|
-
|
37
|
-
::Selenium::WebDriver::Chrome::Service.driver_path&.call
|
38
|
-
else
|
39
|
-
# Selenium <= v3.141.0
|
40
|
-
::Selenium::WebDriver::Chrome.driver_path
|
41
|
-
end
|
36
|
+
::Selenium::WebDriver::Chrome::Service.driver_path&.call
|
42
37
|
when :firefox
|
43
|
-
|
44
|
-
::Selenium::WebDriver::Firefox::Service.driver_path&.call
|
45
|
-
else
|
46
|
-
# Selenium <= v3.141.0
|
47
|
-
::Selenium::WebDriver::Firefox.driver_path
|
48
|
-
end
|
38
|
+
::Selenium::WebDriver::Firefox::Service.driver_path&.call
|
49
39
|
end
|
50
40
|
end
|
51
41
|
|
@@ -3,16 +3,30 @@
|
|
3
3
|
module ActionDispatch
|
4
4
|
module SystemTesting
|
5
5
|
class Driver # :nodoc:
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
attr_reader :name
|
7
|
+
|
8
|
+
def initialize(driver_type, **options, &capabilities)
|
9
|
+
@driver_type = driver_type
|
9
10
|
@screen_size = options[:screen_size]
|
10
11
|
@options = options[:options] || {}
|
12
|
+
@name = @options.delete(:name) || driver_type
|
11
13
|
@capabilities = capabilities
|
12
14
|
|
13
|
-
if
|
15
|
+
if [:poltergeist, :webkit].include?(driver_type)
|
16
|
+
ActiveSupport::Deprecation.warn <<~MSG.squish
|
17
|
+
Poltergeist and capybara-webkit are not maintained already.
|
18
|
+
Driver registration of :poltergeist or :webkit is deprecated and will be removed in Rails 7.1.
|
19
|
+
You can still use :selenium, and also :cuprite is available for alternative to Poltergeist.
|
20
|
+
MSG
|
21
|
+
end
|
22
|
+
|
23
|
+
if driver_type == :selenium
|
24
|
+
gem "selenium-webdriver", ">= 4.0.0"
|
14
25
|
require "selenium/webdriver"
|
26
|
+
@browser = Browser.new(options[:using])
|
15
27
|
@browser.preload
|
28
|
+
else
|
29
|
+
@browser = nil
|
16
30
|
end
|
17
31
|
end
|
18
32
|
|
@@ -24,17 +38,19 @@ module ActionDispatch
|
|
24
38
|
|
25
39
|
private
|
26
40
|
def registerable?
|
27
|
-
[:selenium, :poltergeist, :webkit].include?(@
|
41
|
+
[:selenium, :poltergeist, :webkit, :cuprite, :rack_test].include?(@driver_type)
|
28
42
|
end
|
29
43
|
|
30
44
|
def register
|
31
|
-
@browser
|
45
|
+
@browser&.configure(&@capabilities)
|
32
46
|
|
33
|
-
Capybara.register_driver
|
34
|
-
case @
|
47
|
+
Capybara.register_driver name do |app|
|
48
|
+
case @driver_type
|
35
49
|
when :selenium then register_selenium(app)
|
36
50
|
when :poltergeist then register_poltergeist(app)
|
37
51
|
when :webkit then register_webkit(app)
|
52
|
+
when :cuprite then register_cuprite(app)
|
53
|
+
when :rack_test then register_rack_test(app)
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
@@ -44,7 +60,7 @@ module ActionDispatch
|
|
44
60
|
end
|
45
61
|
|
46
62
|
def register_selenium(app)
|
47
|
-
Capybara::Selenium::Driver.new(app,
|
63
|
+
Capybara::Selenium::Driver.new(app, browser: @browser.type, **browser_options).tap do |driver|
|
48
64
|
driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size)
|
49
65
|
end
|
50
66
|
end
|
@@ -59,8 +75,16 @@ module ActionDispatch
|
|
59
75
|
end
|
60
76
|
end
|
61
77
|
|
78
|
+
def register_cuprite(app)
|
79
|
+
Capybara::Cuprite::Driver.new(app, @options.merge(window_size: @screen_size))
|
80
|
+
end
|
81
|
+
|
82
|
+
def register_rack_test(app)
|
83
|
+
Capybara::RackTest::Driver.new(app, respect_data_method: true, **@options)
|
84
|
+
end
|
85
|
+
|
62
86
|
def setup
|
63
|
-
Capybara.current_driver =
|
87
|
+
Capybara.current_driver = name
|
64
88
|
end
|
65
89
|
end
|
66
90
|
end
|
@@ -15,8 +15,11 @@ module ActionDispatch
|
|
15
15
|
#
|
16
16
|
# The screenshot will be displayed in your console, if supported.
|
17
17
|
#
|
18
|
+
# The default screenshots directory is +tmp/screenshots+ but you can set a different
|
19
|
+
# one with +Capybara.save_path+
|
20
|
+
#
|
18
21
|
# You can set the +RAILS_SYSTEM_TESTING_SCREENSHOT_HTML+ environment variable to
|
19
|
-
# save the HTML from the page that is being
|
22
|
+
# save the HTML from the page that is being screenshotted so you can investigate the
|
20
23
|
# elements on the page at the time of the screenshot
|
21
24
|
#
|
22
25
|
# You can set the +RAILS_SYSTEM_TESTING_SCREENSHOT+ environment variable to
|
@@ -37,12 +40,9 @@ module ActionDispatch
|
|
37
40
|
# Takes a screenshot of the current page in the browser if the test
|
38
41
|
# failed.
|
39
42
|
#
|
40
|
-
# +take_failed_screenshot+ is
|
41
|
-
# that is generated with the application. To take screenshots when a test
|
42
|
-
# fails add +take_failed_screenshot+ to the teardown block before clearing
|
43
|
-
# sessions.
|
43
|
+
# +take_failed_screenshot+ is called during system test teardown.
|
44
44
|
def take_failed_screenshot
|
45
|
-
take_screenshot if failed? && supports_screenshot?
|
45
|
+
take_screenshot if failed? && supports_screenshot? && Capybara::Session.instance_created?
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
@@ -76,7 +76,11 @@ module ActionDispatch
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def absolute_path
|
79
|
-
Rails.root.join(
|
79
|
+
Rails.root.join(screenshots_dir, image_name)
|
80
|
+
end
|
81
|
+
|
82
|
+
def screenshots_dir
|
83
|
+
Capybara.save_path.presence || "tmp/screenshots"
|
80
84
|
end
|
81
85
|
|
82
86
|
def absolute_image_path
|
@@ -4,14 +4,6 @@ module ActionDispatch
|
|
4
4
|
module SystemTesting
|
5
5
|
module TestHelpers
|
6
6
|
module SetupAndTeardown # :nodoc:
|
7
|
-
def host!(host)
|
8
|
-
ActiveSupport::Deprecation.warn \
|
9
|
-
"ActionDispatch::SystemTestCase#host! is deprecated with no replacement. " \
|
10
|
-
"Set Capybara.app_host directly or rely on Capybara's default host."
|
11
|
-
|
12
|
-
Capybara.app_host = host
|
13
|
-
end
|
14
|
-
|
15
7
|
def before_teardown
|
16
8
|
take_failed_screenshot
|
17
9
|
ensure
|
@@ -20,7 +20,7 @@ module ActionDispatch
|
|
20
20
|
#
|
21
21
|
# You can also pass an explicit status number like <tt>assert_response(501)</tt>
|
22
22
|
# or its symbolic equivalent <tt>assert_response(:not_implemented)</tt>.
|
23
|
-
# See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list.
|
23
|
+
# See +Rack::Utils::SYMBOL_TO_STATUS_CODE+ for a full list.
|
24
24
|
#
|
25
25
|
# # Asserts that the response was a redirection
|
26
26
|
# assert_response :redirect
|
@@ -18,8 +18,8 @@ module ActionDispatch
|
|
18
18
|
# match +path+. Basically, it asserts that \Rails recognizes the route given by +expected_options+.
|
19
19
|
#
|
20
20
|
# Pass a hash in the second argument (+path+) to specify the request method. This is useful for routes
|
21
|
-
# requiring a specific HTTP method. The hash should contain a
|
22
|
-
# and a
|
21
|
+
# requiring a specific HTTP method. The hash should contain a +:path+ with the incoming request path
|
22
|
+
# and a +:method+ containing the required HTTP verb.
|
23
23
|
#
|
24
24
|
# # Asserts that POSTing to /items will call the create action on ItemsController
|
25
25
|
# assert_recognizes({controller: 'items', action: 'create'}, {path: 'items', method: :post})
|
@@ -187,6 +187,7 @@ module ActionDispatch
|
|
187
187
|
super
|
188
188
|
end
|
189
189
|
end
|
190
|
+
ruby2_keywords(:method_missing)
|
190
191
|
|
191
192
|
private
|
192
193
|
# Recognizes the route for a given path.
|
@@ -1,14 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rails-dom-testing"
|
4
|
+
require "action_dispatch/testing/assertions/response"
|
5
|
+
require "action_dispatch/testing/assertions/routing"
|
4
6
|
|
5
7
|
module ActionDispatch
|
6
8
|
module Assertions
|
7
|
-
autoload :ResponseAssertions, "action_dispatch/testing/assertions/response"
|
8
|
-
autoload :RoutingAssertions, "action_dispatch/testing/assertions/routing"
|
9
|
-
|
10
|
-
extend ActiveSupport::Concern
|
11
|
-
|
12
9
|
include ResponseAssertions
|
13
10
|
include RoutingAssertions
|
14
11
|
include Rails::Dom::Testing::Assertions
|
@@ -8,7 +8,7 @@ require "minitest"
|
|
8
8
|
require "action_dispatch/testing/request_encoder"
|
9
9
|
|
10
10
|
module ActionDispatch
|
11
|
-
module Integration
|
11
|
+
module Integration # :nodoc:
|
12
12
|
module RequestHelpers
|
13
13
|
# Performs a GET request with the given parameters. See ActionDispatch::Integration::Session#process
|
14
14
|
# for more details.
|
@@ -199,7 +199,7 @@ module ActionDispatch
|
|
199
199
|
# merged into the Rack env hash.
|
200
200
|
# - +env+: Additional env to pass, as a Hash. The headers will be
|
201
201
|
# merged into the Rack env hash.
|
202
|
-
# - +xhr+: Set to +true+ if you want to make
|
202
|
+
# - +xhr+: Set to +true+ if you want to make an Ajax request.
|
203
203
|
# Adds request headers characteristic of XMLHttpRequest e.g. HTTP_X_REQUESTED_WITH.
|
204
204
|
# The headers will be merged into the Rack env hash.
|
205
205
|
# - +as+: Used for encoding the request with different content type.
|
@@ -363,13 +363,11 @@ module ActionDispatch
|
|
363
363
|
reset_html_document = "@html_document = nil"
|
364
364
|
end
|
365
365
|
|
366
|
-
definition = RUBY_VERSION >= "2.7" ? "..." : "*args"
|
367
|
-
|
368
366
|
module_eval <<~RUBY, __FILE__, __LINE__ + 1
|
369
|
-
def #{method}(
|
367
|
+
def #{method}(...)
|
370
368
|
#{reset_html_document}
|
371
369
|
|
372
|
-
result = integration_session.#{method}(
|
370
|
+
result = integration_session.#{method}(...)
|
373
371
|
copy_session_variables!
|
374
372
|
result
|
375
373
|
end
|
@@ -404,7 +402,7 @@ module ActionDispatch
|
|
404
402
|
|
405
403
|
# Copy the instance variables from the current session instance into the
|
406
404
|
# test instance.
|
407
|
-
def copy_session_variables!
|
405
|
+
def copy_session_variables! # :nodoc:
|
408
406
|
@controller = @integration_session.controller
|
409
407
|
@response = @integration_session.response
|
410
408
|
@request = @integration_session.request
|
@@ -433,7 +431,7 @@ module ActionDispatch
|
|
433
431
|
super
|
434
432
|
end
|
435
433
|
end
|
436
|
-
ruby2_keywords(:method_missing)
|
434
|
+
ruby2_keywords(:method_missing)
|
437
435
|
end
|
438
436
|
end
|
439
437
|
|
@@ -8,42 +8,16 @@ module ActionDispatch
|
|
8
8
|
module FixtureFile
|
9
9
|
# Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)</tt>:
|
10
10
|
#
|
11
|
-
# post :change_avatar, params: { avatar: fixture_file_upload('
|
11
|
+
# post :change_avatar, params: { avatar: fixture_file_upload('david.png', 'image/png') }
|
12
12
|
#
|
13
13
|
# Default fixture files location is <tt>test/fixtures/files</tt>.
|
14
14
|
#
|
15
15
|
# To upload binary files on Windows, pass <tt>:binary</tt> as the last parameter.
|
16
16
|
# This will not affect other platforms:
|
17
17
|
#
|
18
|
-
# post :change_avatar, params: { avatar: fixture_file_upload('
|
18
|
+
# post :change_avatar, params: { avatar: fixture_file_upload('david.png', 'image/png', :binary) }
|
19
19
|
def fixture_file_upload(path, mime_type = nil, binary = false)
|
20
|
-
if self.class.
|
21
|
-
!File.exist?(path)
|
22
|
-
original_path = path
|
23
|
-
path = Pathname.new(self.class.fixture_path).join(path)
|
24
|
-
|
25
|
-
if !self.class.file_fixture_path
|
26
|
-
ActiveSupport::Deprecation.warn(<<~EOM)
|
27
|
-
Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
|
28
|
-
In Rails 7.0, the path needs to be relative to `file_fixture_path` which you
|
29
|
-
haven't set yet. Set `file_fixture_path` to discard this warning.
|
30
|
-
EOM
|
31
|
-
elsif path.exist?
|
32
|
-
non_deprecated_path = Pathname(File.absolute_path(path)).relative_path_from(Pathname(File.absolute_path(self.class.file_fixture_path)))
|
33
|
-
|
34
|
-
if Pathname(original_path) != non_deprecated_path
|
35
|
-
ActiveSupport::Deprecation.warn(<<~EOM)
|
36
|
-
Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
|
37
|
-
In Rails 7.0, the path needs to be relative to `file_fixture_path`.
|
38
|
-
|
39
|
-
Please modify the call from
|
40
|
-
`fixture_file_upload("#{original_path}")` to `fixture_file_upload("#{non_deprecated_path}")`.
|
41
|
-
EOM
|
42
|
-
end
|
43
|
-
else
|
44
|
-
path = file_fixture(original_path)
|
45
|
-
end
|
46
|
-
elsif self.class.file_fixture_path && !File.exist?(path)
|
20
|
+
if self.class.file_fixture_path && !File.exist?(path)
|
47
21
|
path = file_fixture(path)
|
48
22
|
end
|
49
23
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require "action_dispatch/testing/request_encoder"
|
4
4
|
|
5
5
|
module ActionDispatch
|
6
|
-
# Integration test methods such as
|
7
|
-
# and
|
6
|
+
# Integration test methods such as Integration::RequestHelpers#get
|
7
|
+
# and Integration::RequestHelpers#post return objects of class
|
8
8
|
# TestResponse, which represent the HTTP response results of the requested
|
9
9
|
# controller actions.
|
10
10
|
#
|
@@ -14,6 +14,24 @@ module ActionDispatch
|
|
14
14
|
new response.status, response.headers, response.body
|
15
15
|
end
|
16
16
|
|
17
|
+
# Returns a parsed body depending on the response MIME type. When a parser
|
18
|
+
# corresponding to the MIME type is not found, it returns the raw body.
|
19
|
+
#
|
20
|
+
# ==== Examples
|
21
|
+
# get "/posts"
|
22
|
+
# response.content_type # => "text/html; charset=utf-8"
|
23
|
+
# response.parsed_body.class # => String
|
24
|
+
# response.parsed_body # => "<!DOCTYPE html>\n<html>\n..."
|
25
|
+
#
|
26
|
+
# get "/posts.json"
|
27
|
+
# response.content_type # => "application/json; charset=utf-8"
|
28
|
+
# response.parsed_body.class # => Array
|
29
|
+
# response.parsed_body # => [{"id"=>42, "title"=>"Title"},...
|
30
|
+
#
|
31
|
+
# get "/posts/42.json"
|
32
|
+
# response.content_type # => "application/json; charset=utf-8"
|
33
|
+
# response.parsed_body.class # => Hash
|
34
|
+
# response.parsed_body # => {"id"=>42, "title"=>"Title"}
|
17
35
|
def parsed_body
|
18
36
|
@parsed_body ||= response_parser.call(body)
|
19
37
|
end
|
data/lib/action_dispatch.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActionPack
|
4
|
-
# Returns the version of
|
4
|
+
# Returns the currently loaded version of Action Pack as a <tt>Gem::Version</tt>.
|
5
5
|
def self.gem_version
|
6
6
|
Gem::Version.new VERSION::STRING
|
7
7
|
end
|
8
8
|
|
9
9
|
module VERSION
|
10
|
-
MAJOR =
|
11
|
-
MINOR =
|
12
|
-
TINY =
|
13
|
-
PRE = "
|
10
|
+
MAJOR = 7
|
11
|
+
MINOR = 0
|
12
|
+
TINY = 8
|
13
|
+
PRE = "1"
|
14
14
|
|
15
15
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
16
16
|
end
|
data/lib/action_pack/version.rb
CHANGED
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:
|
4
|
+
version: 7.0.8.1
|
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:
|
11
|
+
date: 2024-02-21 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:
|
19
|
+
version: 7.0.8.1
|
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:
|
26
|
+
version: 7.0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '2.0'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 2.
|
36
|
+
version: 2.2.4
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.2.4
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack-test
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 7.0.8.1
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - '='
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: 7.0.8.1
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: activemodel
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - '='
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: 7.0.8.1
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - '='
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: 7.0.8.1
|
123
123
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
124
124
|
testing MVC web applications. Works with any Rack-compatible server.
|
125
125
|
email: david@loudthinking.com
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- lib/action_dispatch/middleware/reloader.rb
|
239
239
|
- lib/action_dispatch/middleware/remote_ip.rb
|
240
240
|
- lib/action_dispatch/middleware/request_id.rb
|
241
|
+
- lib/action_dispatch/middleware/server_timing.rb
|
241
242
|
- lib/action_dispatch/middleware/session/abstract_store.rb
|
242
243
|
- lib/action_dispatch/middleware/session/cache_store.rb
|
243
244
|
- lib/action_dispatch/middleware/session/cookie_store.rb
|
@@ -309,10 +310,10 @@ licenses:
|
|
309
310
|
- MIT
|
310
311
|
metadata:
|
311
312
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
312
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
313
|
-
documentation_uri: https://api.rubyonrails.org/
|
313
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.8.1/actionpack/CHANGELOG.md
|
314
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.8.1/
|
314
315
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
315
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
316
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.8.1/actionpack
|
316
317
|
rubygems_mfa_required: 'true'
|
317
318
|
post_install_message:
|
318
319
|
rdoc_options: []
|
@@ -322,7 +323,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
322
323
|
requirements:
|
323
324
|
- - ">="
|
324
325
|
- !ruby/object:Gem::Version
|
325
|
-
version: 2.
|
326
|
+
version: 2.7.0
|
326
327
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
328
|
requirements:
|
328
329
|
- - ">="
|
@@ -330,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
331
|
version: '0'
|
331
332
|
requirements:
|
332
333
|
- none
|
333
|
-
rubygems_version: 3.
|
334
|
+
rubygems_version: 3.2.22
|
334
335
|
signing_key:
|
335
336
|
specification_version: 4
|
336
337
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|