actionpack 5.0.0.1 → 5.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.

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +195 -0
  3. data/README.rdoc +1 -1
  4. data/lib/abstract_controller/callbacks.rb +3 -1
  5. data/lib/action_controller/metal/data_streaming.rb +1 -0
  6. data/lib/action_controller/metal/etag_with_template_digest.rb +7 -1
  7. data/lib/action_controller/metal/force_ssl.rb +1 -1
  8. data/lib/action_controller/metal/implicit_render.rb +1 -1
  9. data/lib/action_controller/metal/live.rb +6 -1
  10. data/lib/action_controller/metal/renderers.rb +0 -2
  11. data/lib/action_controller/metal/rendering.rb +1 -1
  12. data/lib/action_controller/metal/request_forgery_protection.rb +3 -3
  13. data/lib/action_controller/metal/strong_parameters.rb +53 -15
  14. data/lib/action_controller/test_case.rb +39 -21
  15. data/lib/action_dispatch.rb +1 -0
  16. data/lib/action_dispatch/http/headers.rb +1 -1
  17. data/lib/action_dispatch/http/mime_negotiation.rb +2 -2
  18. data/lib/action_dispatch/http/parameters.rb +8 -1
  19. data/lib/action_dispatch/http/request.rb +0 -12
  20. data/lib/action_dispatch/http/response.rb +15 -8
  21. data/lib/action_dispatch/journey/formatter.rb +3 -1
  22. data/lib/action_dispatch/journey/parser.rb +2 -0
  23. data/lib/action_dispatch/journey/parser_extras.rb +4 -2
  24. data/lib/action_dispatch/journey/route.rb +5 -3
  25. data/lib/action_dispatch/journey/router.rb +3 -1
  26. data/lib/action_dispatch/journey/visitors.rb +3 -1
  27. data/lib/action_dispatch/middleware/cookies.rb +3 -3
  28. data/lib/action_dispatch/middleware/debug_exceptions.rb +5 -1
  29. data/lib/action_dispatch/middleware/debug_locks.rb +122 -0
  30. data/lib/action_dispatch/middleware/exception_wrapper.rb +2 -2
  31. data/lib/action_dispatch/middleware/ssl.rb +14 -5
  32. data/lib/action_dispatch/middleware/static.rb +3 -3
  33. data/lib/action_dispatch/routing/mapper.rb +74 -61
  34. data/lib/action_dispatch/routing/redirection.rb +0 -1
  35. data/lib/action_dispatch/testing/integration.rb +150 -196
  36. data/lib/action_dispatch/testing/request_encoder.rb +53 -0
  37. data/lib/action_dispatch/testing/test_process.rb +2 -1
  38. data/lib/action_dispatch/testing/test_request.rb +1 -1
  39. data/lib/action_dispatch/testing/test_response.rb +7 -2
  40. data/lib/action_pack/gem_version.rb +2 -2
  41. metadata +13 -12
@@ -0,0 +1,53 @@
1
+ module ActionDispatch
2
+ class RequestEncoder # :nodoc:
3
+ class IdentityEncoder
4
+ def content_type; end
5
+ def accept_header; end
6
+ def encode_params(params); params; end
7
+ def response_parser; -> body { body }; end
8
+ end
9
+
10
+ @encoders = { identity: IdentityEncoder.new }
11
+
12
+ attr_reader :response_parser
13
+
14
+ def initialize(mime_name, param_encoder, response_parser)
15
+ @mime = Mime[mime_name]
16
+
17
+ unless @mime
18
+ raise ArgumentError, "Can't register a request encoder for " \
19
+ "unregistered MIME Type: #{mime_name}. See `Mime::Type.register`."
20
+ end
21
+
22
+ @response_parser = response_parser || -> body { body }
23
+ @param_encoder = param_encoder || :"to_#{@mime.symbol}".to_proc
24
+ end
25
+
26
+ def content_type
27
+ @mime.to_s
28
+ end
29
+
30
+ def accept_header
31
+ @mime.to_s
32
+ end
33
+
34
+ def encode_params(params)
35
+ @param_encoder.call(params)
36
+ end
37
+
38
+ def self.parser(content_type)
39
+ mime = Mime::Type.lookup(content_type)
40
+ encoder(mime ? mime.ref : nil).response_parser
41
+ end
42
+
43
+ def self.encoder(name)
44
+ @encoders[name] || @encoders[:identity]
45
+ end
46
+
47
+ def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil)
48
+ @encoders[mime_name] = new(mime_name, param_encoder, response_parser)
49
+ end
50
+
51
+ register_encoder :json, response_parser: -> body { JSON.parse(body) }
52
+ end
53
+ end
@@ -34,7 +34,8 @@ module ActionDispatch
34
34
  #
35
35
  # post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png', :binary)
36
36
  def fixture_file_upload(path, mime_type = nil, binary = false)
37
- if self.class.respond_to?(:fixture_path) && self.class.fixture_path
37
+ if self.class.respond_to?(:fixture_path) && self.class.fixture_path &&
38
+ !File.exist?(path)
38
39
  path = File.join(self.class.fixture_path, path)
39
40
  end
40
41
  Rack::Test::UploadedFile.new(path, mime_type, binary)
@@ -22,7 +22,7 @@ module ActionDispatch
22
22
  private_class_method :default_env
23
23
 
24
24
  def request_method=(method)
25
- set_header('REQUEST_METHOD', method.to_s.upcase)
25
+ super(method.to_s.upcase)
26
26
  end
27
27
 
28
28
  def host=(host)
@@ -1,3 +1,5 @@
1
+ require 'action_dispatch/testing/request_encoder'
2
+
1
3
  module ActionDispatch
2
4
  # Integration test methods such as ActionDispatch::Integration::Session#get
3
5
  # and ActionDispatch::Integration::Session#post return objects of class
@@ -10,6 +12,11 @@ module ActionDispatch
10
12
  new response.status, response.headers, response.body
11
13
  end
12
14
 
15
+ def initialize(*) # :nodoc:
16
+ super
17
+ @response_parser = RequestEncoder.parser(content_type)
18
+ end
19
+
13
20
  # Was the response successful?
14
21
  alias_method :success?, :successful?
15
22
 
@@ -19,8 +26,6 @@ module ActionDispatch
19
26
  # Was there a server-side error?
20
27
  alias_method :error?, :server_error?
21
28
 
22
- attr_writer :response_parser # :nodoc:
23
-
24
29
  def parsed_body
25
30
  @parsed_body ||= @response_parser.call(body)
26
31
  end
@@ -7,8 +7,8 @@ module ActionPack
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
- TINY = 0
11
- PRE = "1"
10
+ TINY = 1
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  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: 5.0.0.1
4
+ version: 5.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: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-11-30 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: 5.0.0.1
19
+ version: 5.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: 5.0.0.1
26
+ version: 5.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: 5.0.0.1
95
+ version: 5.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: 5.0.0.1
102
+ version: 5.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: 5.0.0.1
109
+ version: 5.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: 5.0.0.1
116
+ version: 5.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
@@ -217,6 +217,7 @@ files:
217
217
  - lib/action_dispatch/middleware/callbacks.rb
218
218
  - lib/action_dispatch/middleware/cookies.rb
219
219
  - lib/action_dispatch/middleware/debug_exceptions.rb
220
+ - lib/action_dispatch/middleware/debug_locks.rb
220
221
  - lib/action_dispatch/middleware/exception_wrapper.rb
221
222
  - lib/action_dispatch/middleware/executor.rb
222
223
  - lib/action_dispatch/middleware/flash.rb
@@ -269,6 +270,7 @@ files:
269
270
  - lib/action_dispatch/testing/assertions/response.rb
270
271
  - lib/action_dispatch/testing/assertions/routing.rb
271
272
  - lib/action_dispatch/testing/integration.rb
273
+ - lib/action_dispatch/testing/request_encoder.rb
272
274
  - lib/action_dispatch/testing/test_process.rb
273
275
  - lib/action_dispatch/testing/test_request.rb
274
276
  - lib/action_dispatch/testing/test_response.rb
@@ -290,15 +292,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
290
292
  version: 2.2.2
291
293
  required_rubygems_version: !ruby/object:Gem::Requirement
292
294
  requirements:
293
- - - ">="
295
+ - - ">"
294
296
  - !ruby/object:Gem::Version
295
- version: '0'
297
+ version: 1.3.1
296
298
  requirements:
297
299
  - none
298
300
  rubyforge_project:
299
- rubygems_version: 2.6.6
301
+ rubygems_version: 2.5.2
300
302
  signing_key:
301
303
  specification_version: 4
302
304
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
303
305
  test_files: []
304
- has_rdoc: