|
123 | 123 |
|
124 | 124 | end
|
125 | 125 |
|
126 |
| - describe 'rails 3.0', :lib => :rails30 do |
127 |
| - |
128 |
| - before(:all) { copy_gemfile("rails30") } |
129 |
| - |
130 |
| - def base_path; "file://#{STUB_DIR}/rails30" end |
131 |
| - |
132 |
| - it_should_behave_like 'a rails app' |
133 |
| - |
134 |
| - context "initialized" do |
135 |
| - |
136 |
| - before :all do |
137 |
| - initialize_rails nil, base_path |
138 |
| - end |
139 |
| - after(:all) { restore_rails } |
140 |
| - |
141 |
| - it "loaded rack ~> 1.2" do |
142 |
| - @runtime = @rack_factory.getApplication.getRuntime |
143 |
| - should_eval_as_not_nil "defined?(Rack.release)" |
144 |
| - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.2' |
145 |
| - end |
146 |
| - |
147 |
| - it "disables rack's chunked support (by default)" do |
148 |
| - @runtime = @rack_factory.getApplication.getRuntime |
149 |
| - expect_to_have_monkey_patched_chunked |
150 |
| - end |
151 |
| - |
152 |
| - end |
153 |
| - |
154 |
| - context "initialized (custom)" do |
155 |
| - |
156 |
| - before :all do |
157 |
| - initialize_rails 'custom', base_path |
158 |
| - end |
159 |
| - |
160 |
| - it "booted a custom env with a custom logger" do |
161 |
| - @runtime = @rack_factory.getApplication.getRuntime |
162 |
| - should_eval_as_not_nil "defined?(Rails)" |
163 |
| - should_eval_as_eql_to "Rails.env", 'custom' |
164 |
| - should_eval_as_not_nil "Rails.logger" |
165 |
| - should_eval_as_eql_to "Rails.logger.class.name", 'CustomLogger' |
166 |
| - end |
167 |
| - |
168 |
| - end |
169 |
| - |
170 |
| - end |
171 |
| - |
172 |
| - describe 'rails 3.1', :lib => :rails31 do |
173 |
| - |
174 |
| - before(:all) { copy_gemfile("rails31") } |
175 |
| - |
176 |
| - def base_path; "file://#{STUB_DIR}/rails31" end |
177 |
| - |
178 |
| - it_should_behave_like 'a rails app' |
179 |
| - |
180 |
| - context "initialized" do |
181 |
| - |
182 |
| - before :all do |
183 |
| - initialize_rails 'production', base_path |
184 |
| - end |
185 |
| - after(:all) { restore_rails } |
186 |
| - |
187 |
| - it "loaded META-INF/init.rb" do |
188 |
| - @runtime = @rack_factory.getApplication.getRuntime |
189 |
| - should_eval_as_not_nil "defined?(WARBLER_CONFIG)" |
190 |
| - end |
191 |
| - |
192 |
| - it "loaded rack ~> 1.3" do |
193 |
| - @runtime = @rack_factory.getApplication.getRuntime |
194 |
| - should_eval_as_not_nil "defined?(Rack.release)" |
195 |
| - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.3' |
196 |
| - end |
197 |
| - |
198 |
| - it "booted with a servlet logger" do |
199 |
| - @runtime = @rack_factory.getApplication.getRuntime |
200 |
| - should_eval_as_not_nil "defined?(Rails)" |
201 |
| - should_eval_as_not_nil "Rails.logger" |
202 |
| - should_eval_as_not_nil "Rails.logger.instance_variable_get(:'@logdev')" # Logger::LogDevice |
203 |
| - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", 'JRuby::Rack::ServletLog' |
204 |
| - |
205 |
| - should_eval_as_eql_to "Rails.logger.level", Logger::DEBUG |
206 |
| - end |
207 |
| - |
208 |
| - it "disables rack's chunked support (by default)" do |
209 |
| - @runtime = @rack_factory.getApplication.getRuntime |
210 |
| - expect_to_have_monkey_patched_chunked |
211 |
| - end |
212 |
| - |
213 |
| - end |
214 |
| - |
215 |
| - end |
216 |
| - |
217 |
| - describe 'rails 3.2', :lib => :rails32 do |
218 |
| - |
219 |
| - before(:all) { copy_gemfile("rails32") } |
220 |
| - |
221 |
| - def base_path; "file://#{STUB_DIR}/rails32" end |
222 |
| - |
223 |
| - it_should_behave_like 'a rails app' |
224 |
| - |
225 |
| - context "initialized" do |
226 |
| - |
227 |
| - before(:all) { initialize_rails 'production', base_path } |
228 |
| - after(:all) { restore_rails } |
229 |
| - |
230 |
| - it "loaded rack ~> 1.4" do |
231 |
| - @runtime = @rack_factory.getApplication.getRuntime |
232 |
| - should_eval_as_not_nil "defined?(Rack.release)" |
233 |
| - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.4' |
234 |
| - end |
235 |
| - |
236 |
| - it "booted with a servlet logger" do |
237 |
| - @runtime = @rack_factory.getApplication.getRuntime |
238 |
| - should_eval_as_not_nil "defined?(Rails)" |
239 |
| - should_eval_as_not_nil "Rails.logger" |
240 |
| - should_eval_as_eql_to "Rails.logger.class.name", 'ActiveSupport::TaggedLogging' |
241 |
| - should_eval_as_not_nil "Rails.logger.instance_variable_get(:'@logger')" |
242 |
| - should_eval_as_eql_to "logger = Rails.logger.instance_variable_get(:'@logger'); " + |
243 |
| - "logger.instance_variable_get(:'@logdev').dev.class.name", 'JRuby::Rack::ServletLog' |
244 |
| - |
245 |
| - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
246 |
| - end |
247 |
| - |
248 |
| - it "sets up public_path (as for a war)" do |
249 |
| - @runtime = @rack_factory.getApplication.getRuntime |
250 |
| - should_eval_as_eql_to "Rails.public_path", "#{STUB_DIR}/rails32" |
251 |
| - # make sure it was set early on (before initializers run) : |
252 |
| - should_eval_as_not_nil "defined? Rails32::Application::PUBLIC_PATH" |
253 |
| - should_eval_as_eql_to "Rails32::Application::PUBLIC_PATH", "#{STUB_DIR}/rails32" |
254 |
| - # check if image_tag resolves path to images correctly : |
255 |
| - should_eval_as_eql_to %q{ |
256 |
| - config = ActionController::Base.config; |
257 |
| - asset_paths = ActionView::Helpers::AssetTagHelper::AssetPaths.new(config); |
258 |
| - image_path = asset_paths.compute_public_path('image.jpg', 'images'); |
259 |
| - image_path[0, 18] |
260 |
| - }, '/images/image.jpg?' |
261 |
| - end |
262 |
| - |
263 |
| - it "disables rack's chunked support (by default)" do |
264 |
| - @runtime = @rack_factory.getApplication.getRuntime |
265 |
| - expect_to_have_monkey_patched_chunked |
266 |
| - end |
267 |
| - |
268 |
| - end |
269 |
| - |
270 |
| - end |
271 |
| - |
272 |
| - describe 'rails 4.0', :lib => :rails40 do |
273 |
| - |
274 |
| - before(:all) { copy_gemfile("rails40") } |
275 |
| - |
276 |
| - def base_path; "file://#{STUB_DIR}/rails40" end |
277 |
| - |
278 |
| - it_should_behave_like 'a rails app' |
279 |
| - |
280 |
| - context "initialized" do |
281 |
| - |
282 |
| - before(:all) { initialize_rails 'production', base_path } |
283 |
| - after(:all) { restore_rails } |
284 |
| - |
285 |
| - it "loaded rack ~> 1.5" do |
286 |
| - @runtime = @rack_factory.getApplication.getRuntime |
287 |
| - should_eval_as_not_nil "defined?(Rack.release)" |
288 |
| - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.5' |
289 |
| - end |
290 |
| - |
291 |
| - it "booted with a servlet logger" do |
292 |
| - @runtime = @rack_factory.getApplication.getRuntime |
293 |
| - should_eval_as_not_nil "defined?(Rails)" |
294 |
| - should_eval_as_not_nil "Rails.logger" |
295 |
| - # NOTE: TaggedLogging is a module that extends the instance now : |
296 |
| - should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::TaggedLogging", true |
297 |
| - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", |
298 |
| - 'JRuby::Rack::ServletLog' |
299 |
| - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
300 |
| - end |
301 |
| - |
302 |
| - it "sets up public_path (as for a war)" do |
303 |
| - @runtime = @rack_factory.getApplication.getRuntime |
304 |
| - should_eval_as_eql_to "Rails.public_path.to_s", "#{STUB_DIR}/rails40" # Pathname |
305 |
| - # due config.assets.digest = true and since we're asset pre-compiled : |
306 |
| - #should_eval_as_eql_to %q{ |
307 |
| - # ActionController::Base.helpers.image_path('image.jpg')[0, 14]; |
308 |
| - #}, '/assets/image-' |
309 |
| - end |
310 |
| - |
311 |
| - end |
312 |
| - |
313 |
| - end |
314 |
| - |
315 |
| - describe 'rails 4.1', :lib => :rails41 do |
316 |
| - |
317 |
| - before(:all) do name = :rails41 # copy_gemfile : |
318 |
| - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile"), File.join(STUB_DIR, "#{name}/Gemfile") |
319 |
| - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile.lock"), File.join(STUB_DIR, "#{name}/Gemfile.lock") |
320 |
| - Dir.chdir File.join(STUB_DIR, name.to_s) |
321 |
| - end |
322 |
| - |
323 |
| - def prepare_servlet_context(servlet_context) |
324 |
| - servlet_context.addInitParameter('rails.root', "#{STUB_DIR}/rails41") |
325 |
| - servlet_context.addInitParameter('jruby.rack.layout_class', 'FileSystemLayout') |
326 |
| - end |
327 |
| - |
328 |
| - def base_path; "file://#{STUB_DIR}/rails41" end |
329 |
| - # let(:base_path) { "file://#{STUB_DIR}/rails41" } |
330 |
| - |
331 |
| - it_should_behave_like 'a rails app' |
332 |
| - |
333 |
| - context "initialized" do |
334 |
| - |
335 |
| - before(:all) { initialize_rails 'production', base_path } |
336 |
| - after(:all) { restore_rails } |
337 |
| - |
338 |
| - it "loaded rack ~> 1.5" do |
339 |
| - @runtime = @rack_factory.getApplication.getRuntime |
340 |
| - should_eval_as_not_nil "defined?(Rack.release)" |
341 |
| - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.5' |
342 |
| - end |
343 |
| - |
344 |
| - it "booted with a servlet logger" do |
345 |
| - @runtime = @rack_factory.getApplication.getRuntime |
346 |
| - should_eval_as_not_nil "defined?(Rails)" |
347 |
| - should_eval_as_not_nil "Rails.logger" |
348 |
| - # NOTE: TaggedLogging is a module that extends the instance now : |
349 |
| - should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::TaggedLogging", true |
350 |
| - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", |
351 |
| - 'JRuby::Rack::ServletLog' |
352 |
| - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
353 |
| - end |
354 |
| - |
355 |
| - it "sets up public_path (as for a war)" do |
356 |
| - @runtime = @rack_factory.getApplication.getRuntime |
357 |
| - should_eval_as_eql_to "Rails.public_path.to_s", "#{STUB_DIR}/rails41/public" |
358 |
| - end |
359 |
| - |
360 |
| - end |
361 |
| - |
362 |
| - end |
363 |
| - |
364 | 126 | def expect_to_have_monkey_patched_chunked
|
365 | 127 | @runtime.evalScriptlet "require 'rack/chunked'"
|
366 | 128 | script = %{
|
|
0 commit comments