actionpack 5.0.0.beta1.1 → 5.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -28
- data/MIT-LICENSE +1 -1
- data/lib/abstract_controller/base.rb +2 -2
- data/lib/abstract_controller/rendering.rb +5 -5
- data/lib/action_controller.rb +4 -0
- data/lib/action_controller/api.rb +1 -1
- data/lib/action_controller/api/api_rendering.rb +14 -0
- data/lib/action_controller/metal.rb +2 -1
- data/lib/action_controller/metal/conditional_get.rb +1 -1
- data/lib/action_controller/metal/head.rb +0 -1
- data/lib/action_controller/metal/mime_responds.rb +9 -4
- data/lib/action_controller/metal/renderers.rb +75 -32
- data/lib/action_controller/metal/request_forgery_protection.rb +54 -11
- data/lib/action_controller/metal/strong_parameters.rb +33 -10
- data/lib/action_controller/test_case.rb +8 -8
- data/lib/action_dispatch.rb +2 -1
- data/lib/action_dispatch/http/cache.rb +10 -2
- data/lib/action_dispatch/http/headers.rb +15 -1
- data/lib/action_dispatch/http/mime_negotiation.rb +3 -3
- data/lib/action_dispatch/http/mime_type.rb +38 -47
- data/lib/action_dispatch/http/parameters.rb +1 -1
- data/lib/action_dispatch/http/request.rb +1 -1
- data/lib/action_dispatch/http/response.rb +8 -1
- data/lib/action_dispatch/journey/path/pattern.rb +1 -1
- data/lib/action_dispatch/middleware/ssl.rb +23 -17
- data/lib/action_dispatch/middleware/stack.rb +9 -0
- data/lib/action_dispatch/middleware/static.rb +5 -1
- data/lib/action_dispatch/request/session.rb +3 -3
- data/lib/action_dispatch/routing.rb +2 -1
- data/lib/action_dispatch/routing/inspector.rb +22 -10
- data/lib/action_dispatch/routing/mapper.rb +41 -35
- data/lib/action_dispatch/routing/route_set.rb +11 -2
- data/lib/action_dispatch/testing/assertion_response.rb +49 -0
- data/lib/action_dispatch/testing/assertions/response.rb +14 -14
- data/lib/action_dispatch/testing/test_process.rb +0 -1
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/gem_version.rb +1 -1
- 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
|
33
|
-
|
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(
|
89
|
-
"Expected response to be a <#{
|
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
|
data/lib/action_pack.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: 5.0.0.
|
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
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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:
|