actionpack 5.0.0.beta1.1 → 5.0.0.beta2

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -28
  3. data/MIT-LICENSE +1 -1
  4. data/lib/abstract_controller/base.rb +2 -2
  5. data/lib/abstract_controller/rendering.rb +5 -5
  6. data/lib/action_controller.rb +4 -0
  7. data/lib/action_controller/api.rb +1 -1
  8. data/lib/action_controller/api/api_rendering.rb +14 -0
  9. data/lib/action_controller/metal.rb +2 -1
  10. data/lib/action_controller/metal/conditional_get.rb +1 -1
  11. data/lib/action_controller/metal/head.rb +0 -1
  12. data/lib/action_controller/metal/mime_responds.rb +9 -4
  13. data/lib/action_controller/metal/renderers.rb +75 -32
  14. data/lib/action_controller/metal/request_forgery_protection.rb +54 -11
  15. data/lib/action_controller/metal/strong_parameters.rb +33 -10
  16. data/lib/action_controller/test_case.rb +8 -8
  17. data/lib/action_dispatch.rb +2 -1
  18. data/lib/action_dispatch/http/cache.rb +10 -2
  19. data/lib/action_dispatch/http/headers.rb +15 -1
  20. data/lib/action_dispatch/http/mime_negotiation.rb +3 -3
  21. data/lib/action_dispatch/http/mime_type.rb +38 -47
  22. data/lib/action_dispatch/http/parameters.rb +1 -1
  23. data/lib/action_dispatch/http/request.rb +1 -1
  24. data/lib/action_dispatch/http/response.rb +8 -1
  25. data/lib/action_dispatch/journey/path/pattern.rb +1 -1
  26. data/lib/action_dispatch/middleware/ssl.rb +23 -17
  27. data/lib/action_dispatch/middleware/stack.rb +9 -0
  28. data/lib/action_dispatch/middleware/static.rb +5 -1
  29. data/lib/action_dispatch/request/session.rb +3 -3
  30. data/lib/action_dispatch/routing.rb +2 -1
  31. data/lib/action_dispatch/routing/inspector.rb +22 -10
  32. data/lib/action_dispatch/routing/mapper.rb +41 -35
  33. data/lib/action_dispatch/routing/route_set.rb +11 -2
  34. data/lib/action_dispatch/testing/assertion_response.rb +49 -0
  35. data/lib/action_dispatch/testing/assertions/response.rb +14 -14
  36. data/lib/action_dispatch/testing/test_process.rb +0 -1
  37. data/lib/action_pack.rb +1 -1
  38. data/lib/action_pack/gem_version.rb +1 -1
  39. metadata +12 -9
@@ -1,4 +1,3 @@
1
-
2
1
  module ActionDispatch
3
2
  module Assertions
4
3
  # A small suite of assertions that test responses from \Rails applications.
@@ -29,18 +28,10 @@ module ActionDispatch
29
28
  def assert_response(type, message = nil)
30
29
  message ||= generate_response_message(type)
31
30
 
32
- if Symbol === type
33
- if [:success, :missing, :redirect, :error].include?(type)
34
- assert @response.send(RESPONSE_PREDICATES[type]), message
35
- else
36
- code = Rack::Utils::SYMBOL_TO_STATUS_CODE[type]
37
- if code.nil?
38
- raise ArgumentError, "Invalid response type :#{type}"
39
- end
40
- assert_equal code, @response.response_code, message
41
- end
31
+ if RESPONSE_PREDICATES.keys.include?(type)
32
+ assert @response.send(RESPONSE_PREDICATES[type]), message
42
33
  else
43
- assert_equal type, @response.response_code, message
34
+ assert_equal AssertionResponse.new(type).code, @response.response_code, message
44
35
  end
45
36
  end
46
37
 
@@ -85,8 +76,9 @@ module ActionDispatch
85
76
  end
86
77
  end
87
78
 
88
- def generate_response_message(type, code = @response.response_code)
89
- "Expected response to be a <#{type}>, but was a <#{code}>"
79
+ def generate_response_message(expected, actual = @response.response_code)
80
+ "Expected response to be a <#{code_with_name(expected)}>,"\
81
+ " but was a <#{code_with_name(actual)}>"
90
82
  .concat location_if_redirected
91
83
  end
92
84
 
@@ -95,6 +87,14 @@ module ActionDispatch
95
87
  location = normalize_argument_to_redirection(@response.location)
96
88
  " redirect to <#{location}>"
97
89
  end
90
+
91
+ def code_with_name(code_or_name)
92
+ if RESPONSE_PREDICATES.values.include?("#{code_or_name}?".to_sym)
93
+ code_or_name = RESPONSE_PREDICATES.invert["#{code_or_name}?".to_sym]
94
+ end
95
+
96
+ AssertionResponse.new(code_or_name).code_and_name
97
+ end
98
98
  end
99
99
  end
100
100
  end
@@ -1,6 +1,5 @@
1
1
  require 'action_dispatch/middleware/cookies'
2
2
  require 'action_dispatch/middleware/flash'
3
- require 'active_support/core_ext/hash/indifferent_access'
4
3
 
5
4
  module ActionDispatch
6
5
  module TestProcess
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2004-2015 David Heinemeier Hansson
2
+ # Copyright (c) 2004-2016 David Heinemeier Hansson
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -8,7 +8,7 @@ module ActionPack
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "beta1.1"
11
+ PRE = "beta2"
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.beta1.1
4
+ version: 5.0.0.beta2
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-01-25 00:00:00.000000000 Z
11
+ date: 2016-02-01 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.beta1.1
19
+ version: 5.0.0.beta2
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.beta1.1
26
+ version: 5.0.0.beta2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 5.0.0.beta1.1
101
+ version: 5.0.0.beta2
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: 5.0.0.beta1.1
108
+ version: 5.0.0.beta2
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: 5.0.0.beta1.1
115
+ version: 5.0.0.beta2
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: 5.0.0.beta1.1
122
+ version: 5.0.0.beta2
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
@@ -143,6 +143,7 @@ files:
143
143
  - lib/abstract_controller/url_for.rb
144
144
  - lib/action_controller.rb
145
145
  - lib/action_controller/api.rb
146
+ - lib/action_controller/api/api_rendering.rb
146
147
  - lib/action_controller/base.rb
147
148
  - lib/action_controller/caching.rb
148
149
  - lib/action_controller/caching/fragments.rb
@@ -268,6 +269,7 @@ files:
268
269
  - lib/action_dispatch/routing/route_set.rb
269
270
  - lib/action_dispatch/routing/routes_proxy.rb
270
271
  - lib/action_dispatch/routing/url_for.rb
272
+ - lib/action_dispatch/testing/assertion_response.rb
271
273
  - lib/action_dispatch/testing/assertions.rb
272
274
  - lib/action_dispatch/testing/assertions/response.rb
273
275
  - lib/action_dispatch/testing/assertions/routing.rb
@@ -299,8 +301,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
301
  requirements:
300
302
  - none
301
303
  rubyforge_project:
302
- rubygems_version: 2.5.1
304
+ rubygems_version: 2.5.2
303
305
  signing_key:
304
306
  specification_version: 4
305
307
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
306
308
  test_files: []
309
+ has_rdoc: