@@ -170,7 +170,7 @@ def it_should_rewind_body
170
170
$servlet_context = @servlet_context
171
171
# NOTE: a workaround to be able to mock it :
172
172
klass = Class . new ( DefaultRackApplicationFactory ) do
173
- def createRackServletWrapper ( runtime , rackup ) ; end
173
+ def createRackServletWrapper ( runtime , rackup , filename ) ; end
174
174
end
175
175
@app_factory = klass . new
176
176
@@ -311,10 +311,10 @@ def newRuntime() # use the current runtime instead of creating new
311
311
end
312
312
313
313
it "loads specified version of rack" , :lib => :stub do
314
- gem_install_unless_installed 'rack' , '2.1.4 '
314
+ gem_install_unless_installed 'rack' , '1.3.10 '
315
315
set_config 'jruby.runtime.env' , 'false'
316
316
317
- script = "# rack.version: ~>2.1.0 \n Proc.new { 'proc-rack-app' }"
317
+ script = "# rack.version: ~>1.3.6 \n Proc.new { 'proc-rack-app' }"
318
318
app_factory . setRackupScript script
319
319
@runtime = app_factory . newRuntime
320
320
@runtime . evalScriptlet "ENV['GEM_HOME'] = #{ ENV [ 'GEM_HOME' ] . inspect } "
@@ -323,8 +323,8 @@ def newRuntime() # use the current runtime instead of creating new
323
323
app_factory . checkAndSetRackVersion ( @runtime )
324
324
@runtime . evalScriptlet "require 'rack'"
325
325
326
- should_eval_as_eql_to "Rack.release if defined? Rack.release" , '2.1 '
327
- should_eval_as_eql_to "Gem.loaded_specs['rack'].version.to_s" , '2.1.4 '
326
+ should_eval_as_eql_to "Rack.release if defined? Rack.release" , '1.3 '
327
+ should_eval_as_eql_to "Gem.loaded_specs['rack'].version.to_s" , '1.3.10 '
328
328
end
329
329
330
330
it "loads bundler with rack" , :lib => :stub do
@@ -338,7 +338,7 @@ def newRuntime() # use the current runtime instead of creating new
338
338
@runtime = app_factory . newRuntime
339
339
340
340
file = Tempfile . new ( 'Gemfile' )
341
- file << "source 'http ://rubygems.org'\n gem 'rack', '1.3.6'"
341
+ file << "source 'https ://rubygems.org'\n gem 'rack', '1.3.6'"
342
342
file . flush
343
343
@runtime . evalScriptlet "ENV['BUNDLE_GEMFILE'] = #{ file . path . inspect } "
344
344
@runtime . evalScriptlet "ENV['GEM_HOME'] = #{ ENV [ 'GEM_HOME' ] . inspect } "
@@ -352,57 +352,6 @@ def newRuntime() # use the current runtime instead of creating new
352
352
should_eval_as_eql_to "Gem.loaded_specs['rack'].version.to_s" , '1.3.6'
353
353
end
354
354
355
- # should not matter on 1.7.x due https://github.com/jruby/jruby/pull/123
356
- if JRUBY_VERSION < '1.7.0'
357
- it "does not load any features (until load path is adjusted)" do
358
- set_runtime_environment ( "false" )
359
- # due to incorrectly detected jruby.home some container e.g. WebSphere 8
360
- # fail if things such as 'fileutils' get required during runtime init !
361
-
362
- # TODO: WTF? JRuby magic - $LOADED_FEATURES seems to get "inherited" if
363
- # Ruby.newInstance(config) is called with the factory's defaultConfig,
364
- # but only if it's executed with bundler e.g. `bundle exec rake spec`
365
- #@runtime = app_factory.new_runtime
366
- @runtime = org . jruby . Ruby . newInstance
367
- app_factory . send :initRuntime , @runtime
368
-
369
- #@runtime.evalScriptlet 'puts "initRuntime $LOADED_FEATURES: #{$LOADED_FEATURES.inspect}"'
370
- # NOTE: the above scriptlet behaves slightly different on Travis-CI
371
- # depending on whether jruby + JRUBY_OPTS="--1.9" is used and or using
372
- # jruby-19mode with the later the LOADED_FEATURES do get expanded e.g. :
373
- #
374
- # "/home/travis/builds/kares/jruby-rack/target/classes/rack/handler/servlet.rb",
375
- # "/home/travis/builds/kares/jruby-rack/target/classes/jruby/rack.rb",
376
- # "/home/travis/builds/kares/jruby-rack/target/classes/jruby/rack/environment.rb",
377
- # "java.rb",
378
- # "/home/travis/.rvm/rubies/jruby-1.6.8-d19/lib/ruby/site_ruby/shared/builtin/javasupport.rb",
379
- # "/home/travis/.rvm/rubies/jruby-1.6.8-d19/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb",
380
- # ...
381
- #
382
- # compared to jruby --1.9 :
383
- #
384
- # "enumerator.jar",
385
- # "rack/handler/servlet.rb",
386
- # "jruby/rack.rb",
387
- # "jruby/rack/environment.rb",
388
- # "java.rb",
389
- # "builtin/javasupport.rb",
390
- # "builtin/javasupport/java.rb",
391
- # ...
392
-
393
- reject_files =
394
- "p =~ /.jar$/ || " +
395
- "p =~ /^builtin/ || " +
396
- "p =~ /java.rb$/ || p =~ /jruby.rb$/ || " +
397
- "p =~ /jruby\\ /java.*.rb/ || " +
398
- "p =~ /jruby\\ /rack.*.rb/ || " +
399
- "p =~ /^rack\\ /handler\\ /servlet/"
400
- # NOTE: fails with JRuby 1.7 as it has all kind of things loaded e.g. :
401
- # thread.rb, rbconfig.rb, java.rb, lib/ruby/shared/rubygems.rb etc
402
- should_eval_as_eql_to "$LOADED_FEATURES.reject { |p| #{ reject_files } }" , [ ]
403
- end
404
- end
405
-
406
355
it "initializes the $servlet_context global variable" do
407
356
@runtime = app_factory . new_runtime
408
357
should_not_eval_as_nil "defined?($servlet_context)"
@@ -429,10 +378,10 @@ def newRuntime() # use the current runtime instead of creating new
429
378
set_config 'jruby.runtime.env' , 'false'
430
379
set_config 'jruby.runtime.env.rubyopt' , 'true'
431
380
432
- app_factory = app_factory_with_RUBYOPT '-rubygems '
381
+ app_factory = app_factory_with_RUBYOPT '-W:no-deprecated '
433
382
@runtime = app_factory . newRuntime
434
383
should_eval_as_nil "ENV['HOME']"
435
- should_eval_as_eql_to "ENV['RUBYOPT']" , '-rubygems '
384
+ should_eval_as_eql_to "ENV['RUBYOPT']" , '-W:no-deprecated '
436
385
end
437
386
438
387
it "keeps RUBYOPT by default with empty ENV (backwards compat)" do
@@ -490,7 +439,7 @@ def newRuntime() # use the current runtime instead of creating new
490
439
491
440
private
492
441
493
- def app_factory_with_RUBYOPT ( rubyopt = '-rubygems' )
442
+ def app_factory_with_RUBYOPT ( rubyopt )
494
443
app_factory =
495
444
Class . new ( org . jruby . rack . DefaultRackApplicationFactory ) do
496
445
@@ -613,7 +562,7 @@ def reset_config
613
562
it "should init and create application object" do
614
563
# NOTE: a workaround to be able to mock it :
615
564
klass = Class . new ( RailsRackApplicationFactory ) do
616
- def createRackServletWrapper ( runtime , rackup ) ; end
565
+ def createRackServletWrapper ( runtime , rackup , filename ) ; end
617
566
end
618
567
@app_factory = klass . new
619
568
@@ -990,7 +939,6 @@ def createRackServletWrapper(runtime, rackup); end
990
939
begin
991
940
@shared_factory . init ( @rack_context )
992
941
rescue org . jruby . rack . RackInitializationException => e
993
- e = unwrap_native_exception ( e )
994
942
expect ( e . message ) . to eql 'java.lang.ArithmeticException: 42'
995
943
else
996
944
fail "expected to rescue RackInitializationException"
0 commit comments