1
1
require 'abstract_unit'
2
+ require 'active_support/deprecation'
2
3
3
4
module RenderText
4
5
class MinimalController < ActionController ::Metal
@@ -73,7 +74,10 @@ def with_ivar_in_layout
73
74
74
75
class RenderTextTest < Rack ::TestCase
75
76
test "rendering text from a minimal controller" do
76
- get "/render_text/minimal/index"
77
+ ActiveSupport ::Deprecation . silence do
78
+ get "/render_text/minimal/index"
79
+ end
80
+
77
81
assert_body "Hello World!"
78
82
assert_status 200
79
83
end
@@ -82,7 +86,10 @@ class RenderTextTest < Rack::TestCase
82
86
with_routing do |set |
83
87
set . draw { get ':controller' , action : 'index' }
84
88
85
- get "/render_text/simple"
89
+ ActiveSupport ::Deprecation . silence do
90
+ get "/render_text/simple"
91
+ end
92
+
86
93
assert_body "hello david"
87
94
assert_status 200
88
95
end
@@ -92,67 +99,91 @@ class RenderTextTest < Rack::TestCase
92
99
with_routing do |set |
93
100
set . draw { get ':controller' , action : 'index' }
94
101
95
- get "/render_text/with_layout"
102
+ ActiveSupport ::Deprecation . silence do
103
+ get "/render_text/with_layout"
104
+ end
96
105
97
106
assert_body "hello david"
98
107
assert_status 200
99
108
end
100
109
end
101
110
102
111
test "rendering text, while also providing a custom status code" do
103
- get "/render_text/with_layout/custom_code"
112
+ ActiveSupport ::Deprecation . silence do
113
+ get "/render_text/with_layout/custom_code"
114
+ end
104
115
105
116
assert_body "hello world"
106
117
assert_status 404
107
118
end
108
119
109
120
test "rendering text with nil returns an empty body" do
110
- get "/render_text/with_layout/with_nil"
121
+ ActiveSupport ::Deprecation . silence do
122
+ get "/render_text/with_layout/with_nil"
123
+ end
111
124
112
125
assert_body ""
113
126
assert_status 200
114
127
end
115
128
116
129
test "Rendering text with nil and custom status code returns an empty body and the status" do
117
- get "/render_text/with_layout/with_nil_and_status"
130
+ ActiveSupport ::Deprecation . silence do
131
+ get "/render_text/with_layout/with_nil_and_status"
132
+ end
118
133
119
134
assert_body ""
120
135
assert_status 403
121
136
end
122
137
123
138
test "rendering text with false returns the string 'false'" do
124
- get "/render_text/with_layout/with_false"
139
+ ActiveSupport ::Deprecation . silence do
140
+ get "/render_text/with_layout/with_false"
141
+ end
125
142
126
143
assert_body "false"
127
144
assert_status 200
128
145
end
129
146
130
147
test "rendering text with layout: true" do
131
- get "/render_text/with_layout/with_layout_true"
148
+ ActiveSupport ::Deprecation . silence do
149
+ get "/render_text/with_layout/with_layout_true"
150
+ end
132
151
133
152
assert_body "hello world, I'm here!"
134
153
assert_status 200
135
154
end
136
155
137
156
test "rendering text with layout: 'greetings'" do
138
- get "/render_text/with_layout/with_custom_layout"
157
+ ActiveSupport ::Deprecation . silence do
158
+ get "/render_text/with_layout/with_custom_layout"
159
+ end
139
160
140
161
assert_body "hello world, I wish thee well."
141
162
assert_status 200
142
163
end
143
164
144
165
test "rendering text with layout: false" do
145
- get "/render_text/with_layout/with_layout_false"
166
+ ActiveSupport ::Deprecation . silence do
167
+ get "/render_text/with_layout/with_layout_false"
168
+ end
146
169
147
170
assert_body "hello world"
148
171
assert_status 200
149
172
end
150
173
151
174
test "rendering text with layout: nil" do
152
- get "/render_text/with_layout/with_layout_nil"
175
+ ActiveSupport ::Deprecation . silence do
176
+ get "/render_text/with_layout/with_layout_nil"
177
+ end
153
178
154
179
assert_body "hello world"
155
180
assert_status 200
156
181
end
182
+
183
+ test "rendering text displays deprecation warning" do
184
+ assert_deprecated do
185
+ get "/render_text/with_layout/with_layout_nil"
186
+ end
187
+ end
157
188
end
158
189
end
0 commit comments