diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 6bcbd09d..cf653c69 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
diff --git a/Gemfile b/Gemfile
index cbf214e6..e36b3b55 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,7 @@ group :default do
if rack_version = ENV['RACK_VERSION']
gem 'rack', rack_version
else
- gem 'rack'
+ gem 'rack', '< 3.0'
end
end
@@ -14,4 +14,3 @@ end
gem 'rake', '~> 13.2', :group => :test, :require => nil
gem 'rspec', :group => :test
-gem 'jruby-openssl', :group => :test if JRUBY_VERSION < '1.7.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 43b978fd..ea3386b7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -5,7 +5,7 @@ GEM
bundler
rake
diff-lcs (1.5.1)
- rack (3.0.11)
+ rack (2.2.9)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
@@ -13,7 +13,7 @@ GEM
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
- rspec-expectations (3.13.0)
+ rspec-expectations (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
@@ -26,9 +26,9 @@ PLATFORMS
DEPENDENCIES
appraisal (< 1.0)
- rack
+ rack (< 3.0)
rake (~> 13.2)
rspec
BUNDLED WITH
- 2.4.19
+ 2.3.26
diff --git a/Rakefile b/Rakefile
index d38ff424..629c4892 100644
--- a/Rakefile
+++ b/Rakefile
@@ -64,7 +64,7 @@ task :unpack_gem => "target" do |t|
mkdir_p "target/vendor"
require 'rubygems/installer'
rack_dir = File.basename(gem_file).sub(/\.gem$/, '')
- Gem::Installer.new(Gem::Package.new(gem_file), :unpack => true, :install_dir => rack_dir).unpack "#{target}/#{rack_dir}"
+ Gem::Package.new(gem_file).extract_files("#{target}/#{rack_dir}")
File.open("#{target}/vendor/rack.rb", "w") do |f|
f << "dir = File.dirname(__FILE__)\n"
f << "if dir =~ /.jar!/ && dir !~ /^file:/\n"
@@ -109,8 +109,9 @@ task :speconly => [ :resources, :test_resources ] do
opts = ENV['SPEC_OPTS'] ? ENV['SPEC_OPTS'] : %q{ --format documentation --color }
spec = ENV['SPEC'] || File.join(Dir.getwd, "src/spec/ruby/**/*_spec.rb")
opts = opts.split(' ').push *FileList[spec].to_a
- exec = 'rspec'; exec = Gem.bin_path('rspec', exec) if ENV['FULL_BIN_PATH']
- ruby "-Isrc/spec/ruby", "-rbundler/setup", "-S", exec, *opts
+ ruby = ENV['RUBY'] || 'jruby'
+ args = ruby.split(' ') + %w{-Isrc/spec/ruby -rbundler/setup -S rspec}
+ sh *args, *opts
end
end
diff --git a/examples/camping/Gemfile b/examples/camping/Gemfile
index 9f17a66a..76dc36e0 100644
--- a/examples/camping/Gemfile
+++ b/examples/camping/Gemfile
@@ -1,4 +1,4 @@
-source 'http://rubygems.org'
+source 'https://rubygems.org'
gem 'rack'
gem 'camping'
diff --git a/examples/rails3/Gemfile b/examples/rails3/Gemfile
index 966011e3..48e9d34c 100644
--- a/examples/rails3/Gemfile
+++ b/examples/rails3/Gemfile
@@ -1,4 +1,4 @@
-source 'http://rubygems.org'
+source 'https://rubygems.org'
gem 'rails', '3.1.0'
diff --git a/examples/sinatra/Gemfile b/examples/sinatra/Gemfile
index 6548c0ee..c10abd72 100644
--- a/examples/sinatra/Gemfile
+++ b/examples/sinatra/Gemfile
@@ -1,3 +1,3 @@
-source :rubygems
+source 'https://rubygems.org'
gem 'sinatra'
diff --git a/pom.xml b/pom.xml
index fcb4b4ae..4b86e806 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
jruby-rack
1.2.3-SNAPSHOT
JRuby-Rack
- http://github.com/jruby/jruby-rack/
+ https://github.com/jruby/jruby-rack/
A servlet bridge for (Ruby-based) Rack applications that allow them
to run in Java Application servers using JRuby.
@@ -20,16 +20,14 @@
9.4.7.0
- vendor/gems
- 2.4.19
- false
3.0.3
${project.build.directory}/rubygems
+ 2.0.12
Github
- http://github.com/jruby/jruby-rack/issues
+ https://github.com/jruby/jruby-rack/issues
@@ -46,14 +44,14 @@
scm:git:git://github.com/jruby/jruby-rack.git
scm:git:git@github.com:jruby/jruby-rack.git
- http://github.com/jruby/jruby-rack/
+ https://github.com/jruby/jruby-rack/
HEAD
MIT License
- http://www.opensource.org/licenses/mit-license.php
+ https://www.opensource.org/licenses/mit-license.php
repo
@@ -97,74 +95,54 @@
org.jruby
jruby-core
${jruby.version}
-
-
-
- org.apache.geronimo.specs
- geronimo-servlet_3.0_spec
- 1.0
provided
- org.apache.geronimo.specs
- geronimo-jsp_2.2_spec
- 1.2
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
provided
- org.apache.geronimo.specs
- geronimo-el_2.2_spec
- 1.0.4
+ jakarta.servlet.jsp
+ jakarta.servlet.jsp-api
+ 2.3.6
provided
- org.apache.geronimo.specs
- geronimo-jms_1.1_spec
- 1.1.1
+ jakarta.jms
+ jakarta.jms-api
+ 2.0.3
provided
commons-logging
- commons-logging-api
- 1.1
+ commons-logging
+ 1.3.3
provided
org.slf4j
slf4j-api
- 1.7.2
+ ${slf4j.version}
provided
- log4j
- log4j
- 1.2.17
- provided
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
org.springframework
spring-core
- 3.2.10.RELEASE
+ 3.2.18.RELEASE
test
- rubygems
- jruby-openssl
- 0.9.6
- gem
- provided
-
-
- rubygems
- bundler
- ${bundler.version}
- gem
- provided
-
-
- javax.activation
- activation
- 1.1
+ jakarta.el
+ jakarta.el-api
+ 3.0.3
test
@@ -198,7 +176,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.1
+ 3.13.0
8
@@ -209,17 +187,17 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.17
+ 3.3.1
org.apache.maven.plugins
maven-help-plugin
- 2.2
+ 3.4.1
org.apache.maven.plugins
maven-dependency-plugin
- 2.9
+ 3.7.1
process-sources
@@ -234,26 +212,6 @@
-
- org.jruby.maven
- gem-maven-plugin
- ${jruby.maven.plugins.version}
-
- false
-
- ${gem.home}
-
-
-
-
- gem-install-bundler
- test
-
- initialize
-
-
-
-
org.jruby.maven
bundler-maven-plugin
@@ -264,9 +222,9 @@
test
install
- ${jruby.version}
-
- ${bundler.version}
+ ${jruby.version}
+ false
+ false
@@ -275,16 +233,18 @@
org.jruby.maven
rake-maven-plugin
${jruby.maven.plugins.version}
+
+ ${jruby.version}
+
-
-
-
-
-
-
-
-
-
+
+ rake-spec
+ test
+ rake
+
+ speconly SKIP_SPECS=${maven.test.skip}
+
+
rake-resources
@@ -292,12 +252,16 @@
rake
- ${jruby.version}
resources VERSION=${project.version}
+
+ org.codehaus.mojo
+ versions-maven-plugin
+ 2.17.1
+
@@ -328,7 +292,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 2.10.1
+ 3.7.0
attach-javadocs
diff --git a/src/main/java/org/jruby/rack/DefaultRackConfig.java b/src/main/java/org/jruby/rack/DefaultRackConfig.java
index 37501627..44867c38 100644
--- a/src/main/java/org/jruby/rack/DefaultRackConfig.java
+++ b/src/main/java/org/jruby/rack/DefaultRackConfig.java
@@ -460,7 +460,6 @@ private static Map getLoggerTypes() {
final Map loggerTypes = new HashMap(8);
loggerTypes.put("commons_logging", "org.jruby.rack.logging.CommonsLoggingLogger");
loggerTypes.put("clogging", "org.jruby.rack.logging.CommonsLoggingLogger");
- loggerTypes.put("log4j", "org.jruby.rack.logging.Log4jLogger");
loggerTypes.put("slf4j", "org.jruby.rack.logging.Slf4jLogger");
loggerTypes.put("jul", "org.jruby.rack.logging.JulLogger");
//loggerTypes.put("servlet_context", "org.jruby.rack.logging.ServletContextLogger");
diff --git a/src/main/java/org/jruby/rack/logging/Log4jLogger.java b/src/main/java/org/jruby/rack/logging/Log4jLogger.java
deleted file mode 100644
index 48bd21b0..00000000
--- a/src/main/java/org/jruby/rack/logging/Log4jLogger.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2010-2012 Engine Yard, Inc.
- * Copyright (c) 2011 ThoughtWorks, Inc.
- * Copyright (c) 2007-2009 Sun Microsystems, Inc.
- * This source code is available under the MIT license.
- * See the file LICENSE.txt for details.
- */
-
-package org.jruby.rack.logging;
-
-import org.jruby.rack.RackLogger;
-import org.apache.log4j.Logger;
-
-import static org.jruby.rack.RackLogger.Level.ERROR;
-
-public class Log4jLogger extends RackLogger.Base {
-
- private Logger logger;
-
- public Log4jLogger() {
- logger = Logger.getRootLogger();
- }
-
- public Log4jLogger(String loggerName) {
- setLoggerName(loggerName);
- }
-
- public Logger getLogger() {
- return logger;
- }
-
- public void setLogger(Logger logger) {
- this.logger = logger;
- }
-
- public void setLoggerName(String loggerName) {
- logger = Logger.getLogger(loggerName);
- }
-
- @Override
- public boolean isEnabled(Level level) {
- if ( level == null ) return logger.isInfoEnabled(); // TODO ???!
- switch ( level ) {
- case DEBUG: return logger.isDebugEnabled();
- case INFO: return logger.isInfoEnabled();
- case WARN: return logger.isEnabledFor(org.apache.log4j.Level.WARN);
- case ERROR: return logger.isEnabledFor(org.apache.log4j.Level.ERROR);
- case FATAL: return logger.isEnabledFor(org.apache.log4j.Level.FATAL);
- }
- return logger.isEnabledFor(org.apache.log4j.Level.ALL);
- }
-
- @Override
- public void log(Level level, String message) {
- if ( level == null ) { logger.info(message); return; }
- switch ( level ) {
- case DEBUG: logger.debug(message);
- case INFO: logger.info(message);
- case WARN: logger.warn(message);
- case ERROR: logger.error(message);
- case FATAL: logger.fatal(message);
- }
- }
-
- @Override
- public void log(Level level, String message, Throwable ex) {
- if ( level == null ) { logger.error(message, ex); return; }
- switch ( level ) {
- case DEBUG: logger.debug(message, ex);
- case INFO: logger.info(message, ex);
- case WARN: logger.warn(message, ex);
- case ERROR: logger.error(message, ex);
- case FATAL: logger.fatal(message, ex);
- }
- }
-
- @Override
- public Level getLevel() {
- if ( logger.isEnabledFor(org.apache.log4j.Level.DEBUG) ) return Level.DEBUG;
- if ( logger.isEnabledFor(org.apache.log4j.Level.INFO) ) return Level.INFO ;
- if ( logger.isEnabledFor(org.apache.log4j.Level.WARN) ) return Level.WARN ;
- if ( logger.isEnabledFor(org.apache.log4j.Level.ERROR) ) return Level.ERROR;
- if ( logger.isEnabledFor(org.apache.log4j.Level.FATAL) ) return Level.FATAL;
- return null;
- }
-
-}
diff --git a/src/main/ruby/jruby/rack/booter.rb b/src/main/ruby/jruby/rack/booter.rb
index 92da6881..b3cafef4 100644
--- a/src/main/ruby/jruby/rack/booter.rb
+++ b/src/main/ruby/jruby/rack/booter.rb
@@ -90,7 +90,6 @@ def logger; JRuby::Rack.logger; end
# Boot-up this booter, preparing the environment for the application.
def boot!
- adjust_load_path
adjust_gem_path
ENV['RACK_ENV'] = rack_env
export_global_settings
@@ -171,63 +170,6 @@ def change_working_directory
end
end
- # Adjust the load path (mostly due some J2EE servers slightly misbehaving).
- # @note called during {#boot!}
- def adjust_load_path
- require 'jruby'
- # http://kenai.com/jira/browse/JRUBY_RACK-8 If some containers do
- # not allow proper detection of jruby.home, fall back to this
- tmpdir = ENV_JAVA['java.io.tmpdir']
- if JRuby.runtime.instance_config.jruby_home == tmpdir
- ruby_paths = # mirroring org.jruby.runtime.load.LoadService#init
- if JRUBY_VERSION >= '1.7.0'
- # 2.0 is 1.9 as well and uses the same setup as 1.9 currently ...
- %w{ site_ruby shared } << ( JRuby.runtime.is1_9 ? '1.9' : '1.8' )
- else # <= JRuby 1.6.8
- if JRuby.runtime.is1_9
- %w{ site_ruby/1.9 site_ruby/shared site_ruby/1.8 1.9 }
- else
- %w{ site_ruby/1.8 site_ruby/shared 1.8 }
- end
- end
- # NOTE: most servers end up with 'classpath:/...' entries :
- # JRuby.home: "classpath:/META-INF/jruby.home"
- # $LOAD_PATH (JRuby 1.6.8 --1.9):
- #
- # "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.9"
- # "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/shared"
- # "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8"
- # "classpath:/META-INF/jruby.home/lib/ruby/1.9"
- #
- # $LOAD_PATH (JRuby 1.7.0):
- #
- # classpath:/META-INF/jruby.home/lib/ruby/site_ruby (missing dir)
- # classpath:/META-INF/jruby.home/lib/ruby/shared
- # classpath:/META-INF/jruby.home/lib/ruby/1.9
- #
- # seems to be the case for JBoss/Tomcat/WebLogic - it's best to
- # emulate the same setup for containers such as WebSphere where the
- # JRuby bootstrap fails to detect a correct home and points to /tmp
- #
- # since JRuby 1.6.7 LoadService has better support for 'classpath:'
- # prefixed entries https://github.com/jruby/jruby-rack/issues/89
- #
- # also since JRuby 1.7.0 there's a fix for incorrect home detection
- # (avoids /tmp on IBM WAS) https://github.com/jruby/jruby/pull/123
- #
- ruby_paths.each do |path|
- # NOTE: even better replace everything starting with '/tmp' ?
- if index = $LOAD_PATH.index("#{tmpdir}/lib/ruby/#{path}")
- $LOAD_PATH[index] = "classpath:/META-INF/jruby.home/lib/ruby/#{path}"
- else
- # e.g. "classpath:/META-INF/jruby.home/lib/ruby/1.8"
- full_path = "classpath:/META-INF/jruby.home/lib/ruby/#{path}"
- $LOAD_PATH << full_path unless $LOAD_PATH.include?(full_path)
- end
- end
- end
- end
-
# Checks for *META-INF/init.rb* and *WEB-INF/init.rb* code and evals it.
# These init files are assumed to contain user supplied initialization code
# to be loaded and executed during {#boot!}.
diff --git a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb
index 832cd711..caa804c3 100644
--- a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb
+++ b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb
@@ -33,7 +33,7 @@
end
it "should raise an error if the servlet request is not present" do
- lambda { @session_store.call({}) }.should raise_error
+ expect { @session_store.call({}) }.to raise_error(RuntimeError)
end
it "should do nothing if the session is not accessed" do
@@ -57,7 +57,7 @@
it "should load the session when accessed" do
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']['foo']
end
@session_store.call(@env)
@@ -73,7 +73,7 @@
it "should report session loaded when accessed" do
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']['foo']
end
@session_store.call(@env)
@@ -84,7 +84,7 @@
it "should use custom session hash when loading session" do
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"] = "bar"
end
@session_store.call(@env)
@@ -106,7 +106,7 @@
@session.should_receive(:getAttributeNames).and_return [session_key]
@session.should_receive(:getAttribute).with(session_key).and_return marshal_data.to_java_bytes
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"].should == 1
env['rack.session']["bar"].should == true
end
@@ -120,7 +120,7 @@
@session.should_receive(:getAttribute).with("foo").and_return hash["foo"]
@session.should_receive(:getAttribute).with("bar").and_return hash["bar"]
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"].should == hash["foo"]
env['rack.session']["bar"].should == hash["bar"]
end
@@ -132,7 +132,7 @@
@session.should_receive(:getAttributeNames).and_return ["foo"]
@session.should_receive(:getAttribute).with("foo").and_return java.lang.Object.new
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"].should be_kind_of(java.lang.Object)
end
@session_store.call(@env)
@@ -143,7 +143,7 @@
@session.stub(:getAttribute).and_return nil; @session.stub(:getCreationTime).and_return 1
@session.should_receive(:setAttribute).with(ActionController::Session::JavaServletStore::RAILS_SESSION_KEY,
an_instance_of(Java::byte[]))
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']['foo'] = Object.new
end
@session_store.call(@env)
@@ -154,7 +154,7 @@
@request.should_receive(:getSession).with(true).ordered.and_return @session
@session.should_receive(:setAttribute).with(ActionController::Session::JavaServletStore::RAILS_SESSION_KEY,
an_instance_of(Java::byte[]))
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']['foo'] = Object.new
end
@session_store.call(@env)
@@ -164,7 +164,7 @@
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
@session.should_receive(:setAttribute).with("foo", "bar")
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"] = "bar"
end
@session_store.call(@env)
@@ -176,7 +176,7 @@
@session.should_receive(:setAttribute).with("foo", true)
@session.should_receive(:setAttribute).with("bar", 20)
@session.should_receive(:setAttribute).with("baz", false)
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"] = true
env['rack.session']["bar"] = 20
env['rack.session']["baz"] = false
@@ -188,7 +188,7 @@
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
@session.should_receive(:setAttribute).with("foo", an_instance_of(java.lang.Object))
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']["foo"] = java.lang.Object.new
end
@session_store.call(@env)
@@ -200,7 +200,7 @@
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
@session.should_receive(:removeAttribute).with("foo")
@session.should_receive(:removeAttribute).with("baz")
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session'].delete('foo')
env['rack.session']['baz'] = nil
env['rack.session']['bar'] = 'x'
@@ -212,7 +212,7 @@
@request.should_receive(:getSession).with(false).and_return @session
@session.stub(:getId).and_return(nil)
@session.should_receive(:invalidate).ordered
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session.options'].delete(:id)
#env['rack.session'] = new_session_hash(env)
env['rack.session'].send :load!
@@ -224,11 +224,11 @@
session = double_http_session(nil); session.invalidate
@request.should_receive(:getSession).with(false).and_return session
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session.options'].delete(:id)
env['rack.session'].send :load!
end
- expect( lambda { @session_store.call(@env) } ).to_not raise_error
+ expect { @session_store.call(@env) }.to_not raise_error
end
it "should handle session with an invalid servlet session" do
@@ -240,7 +240,7 @@
@request.should_receive(:getSession).ordered.
with(true).and_return new_session = double_http_session
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session']['foo'] = 'bar'
end
@session_store.call(@env)
@@ -248,7 +248,7 @@
it "should do nothing on session reset if no session is established" do
@request.should_receive(:getSession).with(false).and_return nil
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session.options'].delete(:id)
env['rack.session'] = new_session_hash(env) # not loaded?
end
@@ -260,7 +260,7 @@
@request.should_receive(:getSession).and_return @session
@session.should_receive(:getLastAccessedTime).and_return time
@session.stub(:setAttribute)
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session'].getLastAccessedTime.should == time
lambda { env['rack.session'].blah_blah }.should raise_error(NoMethodError)
end
@@ -274,7 +274,7 @@
new_session = double_http_session
@request.should_receive(:getSession).ordered.with(true).and_return(new_session)
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session.options'] = { :id => sid, :renew => true, :defer => true }
env['rack.session']['_csrf_token'] = 'v3PrzsdkWug9Q3xCthKkEzUMbZSzgQ9Bt+43lH0bEF8='
end
@@ -292,11 +292,11 @@
it "handles the skip session option" do
@request.should_receive(:getSession).with(false).and_return @session
@session.should_not_receive(:setAttribute)
- @app.should_receive(:call).and_return do |env|
+ @app.should_receive(:call) do |env|
env['rack.session.options'][:skip] = true
env['rack.session']['foo'] = 'bar'
end
- expect( lambda { @session_store.call(@env) } ).to_not raise_error
+ expect { @session_store.call(@env) }.to_not raise_error
end
private
diff --git a/src/spec/ruby/cgi/session/java_servlet_store_spec.rb b/src/spec/ruby/cgi/session/java_servlet_store_spec.rb
index 602dbb2a..7a936950 100644
--- a/src/spec/ruby/cgi/session/java_servlet_store_spec.rb
+++ b/src/spec/ruby/cgi/session/java_servlet_store_spec.rb
@@ -24,7 +24,7 @@ def session_store
it "should raise an error if the servlet request is not present" do
@options.delete("java_servlet_request")
- lambda { session_store }.should raise_error
+ expect { session_store }.to raise_error(RuntimeError)
end
describe "#restore" do
diff --git a/src/spec/ruby/jruby/rack/app_layout_spec.rb b/src/spec/ruby/jruby/rack/app_layout_spec.rb
index 2dcd9099..20a1ebec 100644
--- a/src/spec/ruby/jruby/rack/app_layout_spec.rb
+++ b/src/spec/ruby/jruby/rack/app_layout_spec.rb
@@ -89,15 +89,14 @@
shared_examples "FileSystemLayout" do
- @@__work_dir__ = Dir.pwd
-
before do
+ @original_work_dir = Dir.pwd
require 'tmpdir'
Dir.chdir Dir.mktmpdir
end
after do
- Dir.chdir @@__work_dir__
+ Dir.chdir @original_work_dir
end
it "sets app and public uri defaults based on a typical (Rails/Rack) app" do
diff --git a/src/spec/ruby/jruby/rack/booter_spec.rb b/src/spec/ruby/jruby/rack/booter_spec.rb
index 7a8cdd1c..0a8c4e3a 100644
--- a/src/spec/ruby/jruby/rack/booter_spec.rb
+++ b/src/spec/ruby/jruby/rack/booter_spec.rb
@@ -16,14 +16,16 @@
after(:all) { JRuby::Rack.context = nil }
- @@rack_env = ENV['RACK_ENV']
- @@gem_path = Gem.path.dup
- @@env_gem_path = ENV['GEM_PATH']
+ before do
+ @rack_env = ENV['RACK_ENV']
+ @gem_path = Gem.path.to_a
+ @env_gem_path = ENV['GEM_PATH']
+ end
after do
- @@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @@rack_env
- Gem.path.replace(@@gem_path)
- @@env_gem_path.nil? ? ENV.delete('GEM_PATH') : ENV['GEM_PATH'] = @@env_gem_path
+ @rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @rack_env
+ Gem.path.replace(@gem_path)
+ @env_gem_path.nil? ? ENV.delete('GEM_PATH') : ENV['GEM_PATH'] = @env_gem_path
end
it "should determine the public html root from the 'public.root' init parameter" do
@@ -142,16 +144,6 @@
ENV['GEM_PATH'].should == "/home/gems#{File::PATH_SEPARATOR}/usr/local/gems"
end
-# it "keeps ENV['GEM_PATH'] when gem_path is nil" do
-# ENV['GEM_PATH'] = '/usr/local/gems'
-# booter.layout = layout = double('layout')
-# layout.stub(:app_path).and_return '.'
-# layout.stub(:public_path).and_return nil
-# layout.should_receive(:gem_path).and_return nil
-# booter.boot!
-# ENV['GEM_PATH'].should == "/usr/local/gems"
-# end
-
it "sets ENV['GEM_PATH'] to the value of gem_path if ENV['GEM_PATH'] is not present" do
@rack_context.should_receive(:getInitParameter).with("jruby.rack.env.gem_path").and_return 'true'
ENV.delete('GEM_PATH')
@@ -236,94 +228,6 @@
booter.boot! # expect to_not raise_error
end
- require 'jruby'
-
- if JRUBY_VERSION >= '1.7.0'
- it "adjusts load path when runtime.jruby_home == /tmp" do
- tmpdir = java.lang.System.getProperty('java.io.tmpdir')
- jruby_home = JRuby.runtime.instance_config.getJRubyHome
- load_path = $LOAD_PATH.dup
- begin # emulating a "bare" load path :
- $LOAD_PATH.clear
- $LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby"
- $LOAD_PATH << "#{tmpdir}/lib/ruby/shared"
- $LOAD_PATH << (JRuby.runtime.is1_9 ? "#{tmpdir}/lib/ruby/1.9" : "#{tmpdir}/lib/ruby/1.8")
- $LOAD_PATH << "." if RUBY_VERSION.index('1.8')
- # "stub" runtime.jruby_home :
- JRuby.runtime.instance_config.setJRubyHome(tmpdir)
-
- #booter.stub(:require)
- booter.boot!
-
- expected = []
- if JRuby.runtime.is1_9
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/shared"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/1.9"
- else
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/shared"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/1.8"
- expected << "."
- end
- $LOAD_PATH.should == expected
- ensure # restore all runtime modifications :
- $LOAD_PATH.clear
- $LOAD_PATH.replace load_path
- JRuby.runtime.instance_config.setJRubyHome(jruby_home)
- end
- end
- else
- it "adjusts load path when runtime.jruby_home == /tmp" do
- tmpdir = java.lang.System.getProperty('java.io.tmpdir')
- jruby_home = JRuby.runtime.instance_config.getJRubyHome
- load_path = $LOAD_PATH.dup
- begin # emulating a "bare" load path :
- $LOAD_PATH.clear
- if JRuby.runtime.is1_9
- # a-realistic setup would be having those commented - but
- # to test the branched code there's artificial noise :
- $LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby/1.9"
- #$LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby/shared"
- $LOAD_PATH << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/shared"
- $LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby/1.8"
- #$LOAD_PATH << "#{tmpdir}/lib/ruby/1.9"
- else
- $LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby/1.8"
- #$LOAD_PATH << "#{tmpdir}/lib/ruby/site_ruby/shared"
- $LOAD_PATH << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/shared"
- #$LOAD_PATH << "#{tmpdir}/lib/ruby/1.8"
- end
- $LOAD_PATH << "."
- # "stub" runtime.jruby_home :
- JRuby.runtime.instance_config.setJRubyHome(tmpdir)
-
- booter.boot!
-
- expected = []
- if JRuby.runtime.is1_9
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.9"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/shared"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8"
- #expected << "classpath:/META-INF/jruby.home/lib/ruby/1.9"
- expected << "."
- expected << "classpath:/META-INF/jruby.home/lib/ruby/1.9"
- else
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8"
- expected << "classpath:/META-INF/jruby.home/lib/ruby/site_ruby/shared"
- #expected << "classpath:/META-INF/jruby.home/lib/ruby/1.8"
- expected << "."
- expected << "classpath:/META-INF/jruby.home/lib/ruby/1.8"
- end
- $LOAD_PATH.should == expected
- ensure # restore all runtime modifications :
- $LOAD_PATH.clear
- $LOAD_PATH.replace load_path
- JRuby.runtime.instance_config.setJRubyHome(jruby_home)
- end
- end
- end
-
context "within a runtime" do
describe "rack env" do
diff --git a/src/spec/ruby/jruby/rack/helpers_spec.rb b/src/spec/ruby/jruby/rack/helpers_spec.rb
index a2525358..1332e285 100644
--- a/src/spec/ruby/jruby/rack/helpers_spec.rb
+++ b/src/spec/ruby/jruby/rack/helpers_spec.rb
@@ -44,7 +44,7 @@ class SomeKlass < Object
end
it "constantizes strictly" do
- expect( lambda { constantize('Some', A::B) } ).to raise_error(NameError)
+ expect { constantize('Some', A::B) }.to raise_error(NameError)
end
it "constantizes non-stricly from Object (parent) context" do
@@ -95,8 +95,8 @@ class SomeKlass < Object
it "resolves a constant" do
expect( resolve_constant("JRuby::Rack::Helpers::Some") ).to be_a Class
- expect( lambda { resolve_constant("JRuby::Rack::Helpers::Missing") }).to raise_error NameError
- expect( lambda { resolve_constant("JRuby::Rack::Helpers::Another") }).to raise_error NameError
+ expect { resolve_constant("JRuby::Rack::Helpers::Missing") }.to raise_error NameError
+ expect { resolve_constant("JRuby::Rack::Helpers::Another") }.to raise_error NameError
end
end
\ No newline at end of file
diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb
index 77a0c3cb..96a1f009 100644
--- a/src/spec/ruby/jruby/rack/integration_spec.rb
+++ b/src/spec/ruby/jruby/rack/integration_spec.rb
@@ -423,7 +423,7 @@ def expect_to_have_monkey_patched_chunked
should_eval_as_eql_to script, "1\nsecond"
end
- ENV_COPY = ENV.dup
+ ENV_COPY = ENV.to_h
def initialize_rails(env = nil, servlet_context = @servlet_context)
if ! servlet_context || servlet_context.is_a?(String)
diff --git a/src/spec/ruby/jruby/rack/queues_spec.rb b/src/spec/ruby/jruby/rack/queues_spec.rb
index 55a775c3..857b0afc 100644
--- a/src/spec/ruby/jruby/rack/queues_spec.rb
+++ b/src/spec/ruby/jruby/rack/queues_spec.rb
@@ -108,11 +108,11 @@ def mock_message(text)
@registry.register_listener "FooQ", listener
@queue_manager.should_receive(:close).with "FooQ"
@registry.unregister_listener(listener)
- lambda { @registry.receive_message("FooQ", mock_message("msg")) }.should raise_error
+ lambda { @registry.receive_message("FooQ", mock_message("msg")) }.should raise_error(RuntimeError)
end
it "#receive_message should raise an exception if there is no listener for the queue" do
- lambda { @registry.receive_message("NoQ", "hi") }.should raise_error
+ lambda { @registry.receive_message("NoQ", "hi") }.should raise_error(RuntimeError)
end
it "#register_listener should allow multiple listeners per queue" do
@@ -175,7 +175,7 @@ def mock_message(text)
it "should unmarshal the message if the marshal payload property is set" do
@message.should_receive(:getBooleanProperty).with(JRuby::Rack::Queues::MARSHAL_PAYLOAD).and_return true
first = false
- @message.should_receive(:readBytes).twice.and_return do |byte_array|
+ @message.should_receive(:readBytes).twice do |byte_array|
if first
-1
else
@@ -233,13 +233,13 @@ def on_message(msg)
@servlet_context.should_receive(:log).with(/something went wrong/)
lambda do
JRuby::Rack::Queues::MessageDispatcher.new(@listener).dispatch(@message)
- end.should raise_error
+ end.should raise_error(RuntimeError)
end
it "should raise an exception if it was unable to dispatch to anything" do
@message.stub(:getBooleanProperty).and_return false
lambda do
JRuby::Rack::Queues::MessageDispatcher.new(@listener).dispatch(@message)
- end.should raise_error
+ end.should raise_error(RuntimeError)
end
end
diff --git a/src/spec/ruby/jruby/rack/rails_booter_spec.rb b/src/spec/ruby/jruby/rack/rails_booter_spec.rb
index 8c34e202..2e6e9fcd 100644
--- a/src/spec/ruby/jruby/rack/rails_booter_spec.rb
+++ b/src/spec/ruby/jruby/rack/rails_booter_spec.rb
@@ -25,11 +25,14 @@
booter.app_path.should == "./WEB-INF"
end
- @@rails_env = ENV['RAILS_ENV']; @@rack_env = ENV['RACK_ENV']
+ before do
+ @rails_env = ENV['RAILS_ENV']
+ @rack_env = ENV['RACK_ENV']
+ end
after do
- @@rails_env.nil? ? ENV.delete('RAILS_ENV') : ENV['RAILS_ENV'] = @@rails_env
- @@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @@rack_env
+ @rails_env.nil? ? ENV.delete('RAILS_ENV') : ENV['RAILS_ENV'] = @rails_env
+ @rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @rack_env
end
it "should default rails path to /WEB-INF" do
diff --git a/src/spec/ruby/jruby/rack/response_spec.rb b/src/spec/ruby/jruby/rack/response_spec.rb
index e547f5ce..c9338230 100644
--- a/src/spec/ruby/jruby/rack/response_spec.rb
+++ b/src/spec/ruby/jruby/rack/response_spec.rb
@@ -181,7 +181,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
response.write_headers(response_environment)
times = 0
- stream.should_receive(:write).exactly(6).times.with do |bytes|
+ stream.should_receive(:write).exactly(6).times do |bytes|
str = String.from_java_bytes(bytes)
str = str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
case times += 1
@@ -223,7 +223,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
response.write_headers(response_environment)
times = 0
- stream.should_receive(:write).exactly(3).times.with do |bytes|
+ stream.should_receive(:write).exactly(3).times do |bytes|
str = String.from_java_bytes(bytes)
case times += 1
when 1 then str.should == "1\r\n1\r\n"
@@ -258,7 +258,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
response.write_headers(response_environment)
times = 0
- stream.should_receive(:write).exactly(5).times.with do |bytes|
+ stream.should_receive(:write).exactly(5).times do |bytes|
str = String.from_java_bytes(bytes)
case times += 1
when 1 then str.should == "1"
@@ -333,7 +333,7 @@ def body.call; raise 'yielded' end
response.write_body(response_environment)
end
- it "writes a (Temfile) stream using a channel" do
+ it "writes a (Tempfile) stream using a channel" do
body = ( require 'tempfile'; Tempfile.new 'to_channel_spec' )
body << "1234567890"; body << "\n"; body << '1234567890'; body.rewind
def body.each; raise "each not-expected"; end
@@ -357,7 +357,7 @@ def body.each_line; raise "each_line not-expected"; end
response.write_body(response_environment)
expect( stream.to_s ).to eql "1234567890\n1234567890"
- expect { body.close }.to raise_error IOError, /closed/
+ expect { body.to_channel }.not_to raise_error
end
it "streams a file using a channel if wrapped in body_parts",
@@ -404,7 +404,7 @@ def wrap_file_body(path) # Rails style when doing #send_file
path = File.expand_path('../../files/image.jpg', File.dirname(__FILE__))
response = JRuby::Rack::Response.new [ 200, {}, FileBody.new(path) ]
- response.should_receive(:send_file).with do |path, response|
+ response.should_receive(:send_file) do |path, response|
expect( path ).to eql path
expect( response).to be response_environment
end
@@ -526,13 +526,13 @@ def with_swallow_client_abort(client_abort = true)
private
- def update_response_headers(headers, response = response)
+ def update_response_headers(headers)
response.to_java.getHeaders.update(headers)
end
- def new_response_environment(servlet_response = servlet_response)
+ def new_response_environment(this_servlet_response = servlet_response)
org.jruby.rack.RackResponseEnvironment.impl do |name, *args|
- servlet_response.send(name, *args)
+ this_servlet_response.send(name, *args)
end
end
diff --git a/src/spec/ruby/rack/application_spec.rb b/src/spec/ruby/rack/application_spec.rb
index 5edc8e07..3ae88148 100644
--- a/src/spec/ruby/rack/application_spec.rb
+++ b/src/spec/ruby/rack/application_spec.rb
@@ -26,7 +26,7 @@
let(:servlet_context) do
servlet_context = double("servlet_context")
- servlet_context.stub(:getInitParameter).and_return do |name|
+ servlet_context.stub(:getInitParameter) do |name|
name && nil # return null
end
servlet_context
@@ -170,7 +170,7 @@ def it_should_rewind_body
$servlet_context = @servlet_context
# NOTE: a workaround to be able to mock it :
klass = Class.new(DefaultRackApplicationFactory) do
- def createRackServletWrapper(runtime, rackup); end
+ def createRackServletWrapper(runtime, rackup, filename); end
end
@app_factory = klass.new
@@ -182,7 +182,7 @@ def createRackServletWrapper(runtime, rackup); end
@app_factory.init @rack_context
@app_factory.rackup_script.should == nil
- @rack_context.should_receive(:log).with do |*args|
+ @rack_context.should_receive(:log) do |*args|
expect( args.first.to_s ).to eql 'WARN' if args.size > 1
args.last.should =~ /no rackup script found/
end
@@ -208,7 +208,7 @@ def mocked_runtime_application_factory(factory_class = nil)
def newRuntime() # use the current runtime instead of creating new
require 'jruby'
runtime = JRuby.runtime
- JRuby::Rack.silence_warnings { initRuntime(runtime) }
+ JRuby::Rack::Helpers.silence_warnings { initRuntime(runtime) }
runtime
end
end
@@ -221,7 +221,7 @@ def newRuntime() # use the current runtime instead of creating new
@rack_context.stub(:getInitParameter).and_return nil
@rack_context.stub(:getResourcePaths).and_return nil
@rack_context.stub(:getRealPath) { |path| path }
- #@rack_context.stub(:log).with do |*args|
+ #@rack_context.stub(:log) do |*args|
#puts args.inspect
#end
end
@@ -310,24 +310,7 @@ def newRuntime() # use the current runtime instead of creating new
should_eval_as_nil "defined?(::Rack::VERSION)"
end
- it "loads specified version of rack", :lib => :stub do
- gem_install_unless_installed 'rack', '1.3.10'
- set_config 'jruby.runtime.env', 'false'
-
- script = "# rack.version: ~>1.3.6\n Proc.new { 'proc-rack-app' }"
- app_factory.setRackupScript script
- @runtime = app_factory.newRuntime
- @runtime.evalScriptlet "ENV['GEM_HOME'] = #{ENV['GEM_HOME'].inspect}"
- @runtime.evalScriptlet "ENV['GEM_PATH'] = #{ENV['GEM_PATH'].inspect}"
-
- app_factory.checkAndSetRackVersion(@runtime)
- @runtime.evalScriptlet "require 'rack'"
-
- should_eval_as_eql_to "Rack.release if defined? Rack.release", '1.3'
- should_eval_as_eql_to "Gem.loaded_specs['rack'].version.to_s", '1.3.10'
- end
-
- it "loads bundler with rack", :lib => :stub do
+ it "loads specified version of rack via bundler", :lib => :stub do
gem_install_unless_installed 'rack', '1.3.6'
set_config 'jruby.runtime.env', 'false'
@@ -338,7 +321,7 @@ def newRuntime() # use the current runtime instead of creating new
@runtime = app_factory.newRuntime
file = Tempfile.new('Gemfile')
- file << "source 'http://rubygems.org'\n gem 'rack', '1.3.6'"
+ file << "source 'https://rubygems.org'\n gem 'rack', '1.3.6'"
file.flush
@runtime.evalScriptlet "ENV['BUNDLE_GEMFILE'] = #{file.path.inspect}"
@runtime.evalScriptlet "ENV['GEM_HOME'] = #{ENV['GEM_HOME'].inspect}"
@@ -352,57 +335,6 @@ def newRuntime() # use the current runtime instead of creating new
should_eval_as_eql_to "Gem.loaded_specs['rack'].version.to_s", '1.3.6'
end
- # should not matter on 1.7.x due https://github.com/jruby/jruby/pull/123
- if JRUBY_VERSION < '1.7.0'
- it "does not load any features (until load path is adjusted)" do
- set_runtime_environment("false")
- # due to incorrectly detected jruby.home some container e.g. WebSphere 8
- # fail if things such as 'fileutils' get required during runtime init !
-
- # TODO: WTF? JRuby magic - $LOADED_FEATURES seems to get "inherited" if
- # Ruby.newInstance(config) is called with the factory's defaultConfig,
- # but only if it's executed with bundler e.g. `bundle exec rake spec`
- #@runtime = app_factory.new_runtime
- @runtime = org.jruby.Ruby.newInstance
- app_factory.send :initRuntime, @runtime
-
- #@runtime.evalScriptlet 'puts "initRuntime $LOADED_FEATURES: #{$LOADED_FEATURES.inspect}"'
- # NOTE: the above scriptlet behaves slightly different on Travis-CI
- # depending on whether jruby + JRUBY_OPTS="--1.9" is used and or using
- # jruby-19mode with the later the LOADED_FEATURES do get expanded e.g. :
- #
- # "/home/travis/builds/kares/jruby-rack/target/classes/rack/handler/servlet.rb",
- # "/home/travis/builds/kares/jruby-rack/target/classes/jruby/rack.rb",
- # "/home/travis/builds/kares/jruby-rack/target/classes/jruby/rack/environment.rb",
- # "java.rb",
- # "/home/travis/.rvm/rubies/jruby-1.6.8-d19/lib/ruby/site_ruby/shared/builtin/javasupport.rb",
- # "/home/travis/.rvm/rubies/jruby-1.6.8-d19/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb",
- # ...
- #
- # compared to jruby --1.9 :
- #
- # "enumerator.jar",
- # "rack/handler/servlet.rb",
- # "jruby/rack.rb",
- # "jruby/rack/environment.rb",
- # "java.rb",
- # "builtin/javasupport.rb",
- # "builtin/javasupport/java.rb",
- # ...
-
- reject_files =
- "p =~ /.jar$/ || " +
- "p =~ /^builtin/ || " +
- "p =~ /java.rb$/ || p =~ /jruby.rb$/ || " +
- "p =~ /jruby\\/java.*.rb/ || " +
- "p =~ /jruby\\/rack.*.rb/ || " +
- "p =~ /^rack\\/handler\\/servlet/"
- # NOTE: fails with JRuby 1.7 as it has all kind of things loaded e.g. :
- # thread.rb, rbconfig.rb, java.rb, lib/ruby/shared/rubygems.rb etc
- should_eval_as_eql_to "$LOADED_FEATURES.reject { |p| #{reject_files} }", []
- end
- end
-
it "initializes the $servlet_context global variable" do
@runtime = app_factory.new_runtime
should_not_eval_as_nil "defined?($servlet_context)"
@@ -429,10 +361,10 @@ def newRuntime() # use the current runtime instead of creating new
set_config 'jruby.runtime.env', 'false'
set_config 'jruby.runtime.env.rubyopt', 'true'
- app_factory = app_factory_with_RUBYOPT '-rubygems'
+ app_factory = app_factory_with_RUBYOPT '-W:no-deprecated'
@runtime = app_factory.newRuntime
should_eval_as_nil "ENV['HOME']"
- should_eval_as_eql_to "ENV['RUBYOPT']", '-rubygems'
+ should_eval_as_eql_to "ENV['RUBYOPT']", '-W:no-deprecated'
end
it "keeps RUBYOPT by default with empty ENV (backwards compat)" do
@@ -462,14 +394,14 @@ def newRuntime() # use the current runtime instead of creating new
set_config 'jruby.compat.version', '1.9'
#@rack_config.stub(:getCompatVersion).and_return org.jruby.CompatVersion::RUBY1_9
@runtime = app_factory.new_runtime
- @runtime.is1_9.should be_true
+ @runtime.is1_9.should be_truthy
end
it "handles jruby.runtime.arguments == '-X+O -Ke' and start with object space enabled and KCode EUC" do
set_config 'jruby.runtime.arguments', '-X+O -Ke'
#@rack_config.stub(:getRuntimeArguments).and_return ['-X+O', '-Ke'].to_java(:String)
@runtime = app_factory.new_runtime
- @runtime.object_space_enabled.should be_true
+ @runtime.object_space_enabled.should be_truthy
@runtime.kcode.should == Java::OrgJrubyUtil::KCode::EUC
end
@@ -490,7 +422,7 @@ def newRuntime() # use the current runtime instead of creating new
private
- def app_factory_with_RUBYOPT(rubyopt = '-rubygems')
+ def app_factory_with_RUBYOPT(rubyopt)
app_factory =
Class.new(org.jruby.rack.DefaultRackApplicationFactory) do
@@ -613,7 +545,7 @@ def reset_config
it "should init and create application object" do
# NOTE: a workaround to be able to mock it :
klass = Class.new(RailsRackApplicationFactory) do
- def createRackServletWrapper(runtime, rackup); end
+ def createRackServletWrapper(runtime, rackup, filename); end
end
@app_factory = klass.new
@@ -688,7 +620,7 @@ def createRackServletWrapper(runtime, rackup); end
it "creates applications during initialization according to the jruby.min.runtimes context parameter" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
app.should_receive(:init)
app
@@ -721,7 +653,7 @@ def createRackServletWrapper(runtime, rackup); end
it "forces the maximum size to be greater or equal to the initial size" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
app.should_receive(:init)
app
@@ -743,9 +675,9 @@ def createRackServletWrapper(runtime, rackup); end
it "waits till initial runtimes get initialized (with wait set to true)" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return do
+ app.stub(:init) do
sleep(0.10)
end
app
@@ -762,9 +694,9 @@ def createRackServletWrapper(runtime, rackup); end
"(even when only a single application initialization fails)" do
@factory.stub(:init)
app_count = java.util.concurrent.atomic.AtomicInteger.new(0)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return do
+ app.stub(:init) do
if app_count.addAndGet(1) == 2
raise org.jruby.rack.RackInitializationException.new('failed app init')
end
@@ -794,9 +726,9 @@ def createRackServletWrapper(runtime, rackup); end
it "wait until pool is filled when invoking getApplication (with wait set to false)" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return { sleep(0.2) }
+ app.stub(:init) { sleep(0.2) }
app
end
@rack_config.stub(:getBooleanProperty).with("jruby.runtime.init.wait").and_return false
@@ -812,9 +744,9 @@ def createRackServletWrapper(runtime, rackup); end
it "waits acquire timeout till an application is available from the pool (than raises)" do
@factory.stub(:init)
- @factory.should_receive(:newApplication).twice.and_return do
+ @factory.should_receive(:newApplication).twice do
app = double "app"
- app.should_receive(:init).and_return { sleep(0.2) }
+ app.should_receive(:init) { sleep(0.2) }
app
end
@rack_config.stub(:getBooleanProperty).with("jruby.runtime.init.wait").and_return false
@@ -842,9 +774,9 @@ def createRackServletWrapper(runtime, rackup); end
it "gets and initializes new applications until maximum allows to create more" do
@factory.stub(:init)
- @factory.should_receive(:newApplication).twice.and_return do
+ @factory.should_receive(:newApplication).twice do
app = double "app (new)"
- app.should_receive(:init).and_return { sleep(0.1) }
+ app.should_receive(:init) { sleep(0.1) }
app
end
@rack_config.stub(:getBooleanProperty).with("jruby.runtime.init.wait").and_return false
@@ -858,7 +790,7 @@ def createRackServletWrapper(runtime, rackup); end
2.times { @pooling_factory.getApplication.should_not be nil }
}.should_not raise_error
- @factory.should_receive(:getApplication).twice.and_return do
+ @factory.should_receive(:getApplication).twice do
app = double "app (get)"; sleep(0.15); app
end
@@ -879,9 +811,9 @@ def createRackServletWrapper(runtime, rackup); end
it "initializes initial runtimes in paralel (with wait set to false)" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return do
+ app.stub(:init) do
sleep(0.15)
end
app
@@ -902,9 +834,9 @@ def createRackServletWrapper(runtime, rackup); end
it "throws from init when application initialization in thread failed" do
@factory.stub(:init)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return do
+ app.stub(:init) do
sleep(0.05); raise "app.init raising"
end
app
@@ -913,7 +845,7 @@ def createRackServletWrapper(runtime, rackup); end
@rack_config.stub(:getMaximumRuntimes).and_return 2
raise_error_logged = 0
- @rack_context.stub(:log).with do |level, msg, e|
+ @rack_context.stub(:log) do |level, msg, e|
if level.to_s == 'ERROR'
expect( msg ).to eql 'unable to initialize application'
expect( e ).to be_a org.jruby.exceptions.RaiseException
@@ -923,9 +855,7 @@ def createRackServletWrapper(runtime, rackup); end
end
end
- expect(lambda {
- @pooling_factory.init(@rack_context)
- }).to raise_error org.jruby.rack.RackInitializationException
+ expect { @pooling_factory.init(@rack_context) }.to raise_error org.jruby.rack.RackInitializationException
expect( raise_error_logged ).to eql 1 # logs same init exception once
# NOTE: seems it's not such a good idea to return empty on init error
@@ -944,9 +874,9 @@ def createRackServletWrapper(runtime, rackup); end
it "initializes initial runtimes in serial order" do
@factory.should_receive(:init).with(@rack_context)
- @factory.stub(:newApplication).and_return do
+ @factory.stub(:newApplication) do
app = double "app"
- app.stub(:init).and_return do
+ app.stub(:init) do
sleep(0.05)
end
app
@@ -981,7 +911,7 @@ def createRackServletWrapper(runtime, rackup); end
@factory.should_receive(:init).with(@rack_context)
@factory.should_receive(:getApplication).and_raise java.lang.ArithmeticException.new('42')
- @rack_context.should_receive(:log).with do |level, msg, e|
+ @rack_context.should_receive(:log) do |level, msg, e|
if level == 'ERROR'
expect( e ).to be_a java.lang.ArithmeticException
else
@@ -992,7 +922,6 @@ def createRackServletWrapper(runtime, rackup); end
begin
@shared_factory.init(@rack_context)
rescue org.jruby.rack.RackInitializationException => e
- e = unwrap_native_exception(e)
expect( e.message ).to eql 'java.lang.ArithmeticException: 42'
else
fail "expected to rescue RackInitializationException"
@@ -1011,9 +940,7 @@ def createRackServletWrapper(runtime, rackup); end
rescue java.lang.RuntimeException => e
# NOOP
end
- expect( lambda {
- @shared_factory.getApplication
- }).to raise_error(org.jruby.rack.RackInitializationException)
+ expect { @shared_factory.getApplication }.to raise_error(org.jruby.rack.RackInitializationException)
end
it "returns the same application for any newApplication or getApplication call" do
diff --git a/src/spec/ruby/rack/config_spec.rb b/src/spec/ruby/rack/config_spec.rb
index fca979d4..3a31e222 100644
--- a/src/spec/ruby/rack/config_spec.rb
+++ b/src/spec/ruby/rack/config_spec.rb
@@ -54,8 +54,8 @@
end
it "constructs a slf4j logger with default logger name" do
- java.lang.System.setProperty("jruby.rack.logging", "Log4J")
- logger.should be_a(org.jruby.rack.logging.Log4jLogger)
+ java.lang.System.setProperty("jruby.rack.logging", "slf4j")
+ logger.should be_a(org.jruby.rack.logging.Slf4jLogger)
logger.logger.name.should == 'jruby.rack'
end
diff --git a/src/spec/ruby/rack/dispatcher_spec.rb b/src/spec/ruby/rack/dispatcher_spec.rb
index edb5897a..05d63756 100644
--- a/src/spec/ruby/rack/dispatcher_spec.rb
+++ b/src/spec/ruby/rack/dispatcher_spec.rb
@@ -82,9 +82,7 @@
res.stub(:reset)
res.should_not_receive(:sendError)
- expect( lambda {
- @dispatcher.process(req, res)
- } ).to raise_error(org.jruby.rack.RackException)
+ expect { @dispatcher.process(req, res) }.to raise_error(org.jruby.rack.RackException)
end
end
diff --git a/src/spec/ruby/rack/filter_spec.rb b/src/spec/ruby/rack/filter_spec.rb
index b310f118..e5a99109 100644
--- a/src/spec/ruby/rack/filter_spec.rb
+++ b/src/spec/ruby/rack/filter_spec.rb
@@ -39,7 +39,7 @@ def stub_request(path_info)
end
it "should dispatch the filter chain and finish if the chain resulted in a successful response" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.setStatus(200)
end
@response.should_receive(:setStatus).ordered.with(200)
@@ -47,7 +47,7 @@ def stub_request(path_info)
end
it "should finish if the chain resulted in a redirect" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendRedirect("/some/url")
end
@response.should_receive(:sendRedirect).ordered.with("/some/url")
@@ -55,7 +55,7 @@ def stub_request(path_info)
end
it "dispatches to the rack dispatcher if the chain resulted in a 404" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(404)
end
@response.should_receive(:reset).ordered
@@ -67,7 +67,7 @@ def stub_request(path_info)
it "dispatches to the rack dispatcher if the chain resulted in a 403" do
# sending a PUT up the chain results in a 403 on Tomcat
# @see https://github.com/jruby/jruby-rack/issues/105
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(403)
end
@response.should_receive(:reset).ordered
@@ -78,7 +78,7 @@ def stub_request(path_info)
it "dispatches to the rack dispatcher if the chain resulted in a 405" do
# PUT/DELETE up the chain end up as HTTP 405 on Jetty
# @see https://github.com/jruby/jruby-rack/issues/109
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(405)
end
@response.should_receive(:reset).ordered
@@ -89,7 +89,7 @@ def stub_request(path_info)
it "dispatches to the rack dispatcher if the chain resulted in a 501" do
# non standard verbs like PATCH produce HTTP 501
# see also http://httpstatus.es/501 and http://tools.ietf.org/html/rfc5789
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(501)
end
@response.should_receive(:reset)
@@ -106,7 +106,7 @@ def wrapResponse(response)
end
end.new(dispatcher, @rack_context)
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(442)
end
@response.should_receive(:reset).ordered
@@ -115,7 +115,7 @@ def wrapResponse(response)
end
it "allows downstream entities to flush the buffer in the case of a successful response" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.setStatus(200)
resp.flushBuffer
end
@@ -126,7 +126,7 @@ def wrapResponse(response)
end
it "does not allow downstream entities in the chain to flush the buffer in the case of an 404" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(404)
resp.flushBuffer
end
@@ -137,7 +137,7 @@ def wrapResponse(response)
end
it "only resets the buffer for a 404 if configured so" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(404)
resp.flushBuffer
end
@@ -150,7 +150,7 @@ def wrapResponse(response)
end
it "allows an error response from the filter chain (and flushes the buffer)" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(401)
resp.flushBuffer
end
@@ -170,7 +170,7 @@ def isHandled(arg); getStatus < 400; end
end
end.new(dispatcher, @rack_context)
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(401)
resp.flushBuffer
end
@@ -185,7 +185,7 @@ def isHandled(arg); getStatus < 400; end
request.stub(:getPathInfo).and_return path_info
request.stub(:getServletPath).and_return "/some/uri"
end
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getPathInfo.should == "/index.html"
req.getServletPath.should == "/some/uri"
req.getRequestURI.should == "/some/uri/index.html"
@@ -196,12 +196,12 @@ def isHandled(arg); getStatus < 400; end
end
it "should set status to 404 when dispatcher's status is not found" do
- chain.should_receive(:doFilter).ordered.and_return do |_, resp|
+ chain.should_receive(:doFilter).ordered do |_, resp|
resp.sendError(404) # 404 status is irrelevant here !
end
@response.should_receive(:reset).ordered
@request.should_receive(:setAttribute).ordered.with(org.jruby.rack.RackEnvironment::DYNAMIC_REQS_ONLY, true)
- dispatcher.should_receive(:process).ordered.and_return do |_, resp|
+ dispatcher.should_receive(:process).ordered do |_, resp|
resp.setStatus(404)
end
@response.should_receive(:setStatus).ordered.with(404)
@@ -216,7 +216,7 @@ def isHandled(arg); getStatus < 400; end
it "should dispatch /some/uri/index.html unchanged" do
stub_request("/index.html")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getRequestURI.should == "/some/uri/index.html"
resp.setStatus(200)
end
@@ -226,7 +226,7 @@ def isHandled(arg); getStatus < 400; end
it "should convert / to /index.html" do
stub_request("/")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getServletPath.should == "/some/uri/index.html"
resp.setStatus(200)
end
@@ -239,7 +239,7 @@ def isHandled(arg); getStatus < 400; end
request.stub(:getPathInfo).and_return nil
request.stub(:getServletPath).and_return "/some/uri/index.html"
end
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getPathInfo.should == nil
req.getServletPath.should == "/some/uri/index.html"
req.getRequestURI.should == "/some/uri/"
@@ -251,7 +251,7 @@ def isHandled(arg); getStatus < 400; end
it "should add .html to the path" do
stub_request("")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getServletPath.should == "/some/uri.html"
resp.setStatus(200)
end
@@ -261,7 +261,7 @@ def isHandled(arg); getStatus < 400; end
it "should process dispatching when chain throws a FileNotFoundException (WAS 8.0 behavior)" do
stub_request("/foo")
- chain.should_receive(:doFilter).ordered.and_return do
+ chain.should_receive(:doFilter).ordered do
raise java.io.FileNotFoundException.new("/foo.html")
end
dispatcher.should_receive(:process)
@@ -277,7 +277,7 @@ def isHandled(arg); getStatus < 400; end
end
it "dispatches /some/uri/index unchanged" do
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getServletPath.should == "/some/uri/index"
req.getRequestURI.should == "/some/uri/index"
resp.setStatus(200)
@@ -295,7 +295,7 @@ def isHandled(arg); getStatus < 400; end
end
it "dispatches /some/uri/index unchanged if the resource does not exist" do
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getRequestURI.should == "/some/uri/index"
resp.setStatus(200)
end
@@ -305,7 +305,7 @@ def isHandled(arg); getStatus < 400; end
it "should dispatch /some/uri/index to the filter chain as /some/uri/index.html if the resource exists" do
@rack_context.should_receive(:getResource).with("/some/uri/index.html").and_return java.net.URL.new("file://some/uri/index.html")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getRequestURI.should == "/some/uri/index.html"
resp.setStatus(200)
end
@@ -316,7 +316,7 @@ def isHandled(arg); getStatus < 400; end
it "should dispatch /some/uri/ to /some/uri/index.html if the resource exists" do
@rack_context.should_receive(:getResource).with("/some/uri/index.html").and_return java.net.URL.new("file://some/uri/index.html")
stub_request("/")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getRequestURI.should == "/some/uri/index.html"
resp.setStatus(200)
end
@@ -327,7 +327,7 @@ def isHandled(arg); getStatus < 400; end
it "should dispatch to /some/uri.html if the resource exists and there is no path info" do
@rack_context.should_receive(:getResource).with("/some/uri.html").and_return java.net.URL.new("file://some/uri.html")
stub_request("")
- chain.should_receive(:doFilter).ordered.and_return do |req,resp|
+ chain.should_receive(:doFilter).ordered do |req,resp|
req.getServletPath.should == "/some/uri.html"
resp.setStatus(200)
end
diff --git a/src/spec/ruby/rack/handler/servlet_spec.rb b/src/spec/ruby/rack/handler/servlet_spec.rb
index abfbc119..5d3c4f66 100644
--- a/src/spec/ruby/rack/handler/servlet_spec.rb
+++ b/src/spec/ruby/rack/handler/servlet_spec.rb
@@ -542,44 +542,42 @@ def getAttributeNames
env = servlet.create_env filled_servlet_env
env.freeze
- expect( lambda { env['REQUEST_METHOD'] } ).to_not raise_error
- expect( lambda { env['SCRIPT_NAME'] } ).to_not raise_error
+ expect { env['REQUEST_METHOD'] }.to_not raise_error
+ expect { env['SCRIPT_NAME'] }.to_not raise_error
Rack::Handler::Servlet::DefaultEnv::BUILTINS.each do |key|
- expect( lambda { env[key] } ).to_not raise_error
+ expect { env[key] }.to_not raise_error
env[key].should_not be nil
end
- expect( lambda { env['OTHER_METHOD'] } ).to_not raise_error
+ expect { env['OTHER_METHOD'] }.to_not raise_error
env['OTHER_METHOD'].should be nil
- expect( lambda { env['rack.version'] } ).to_not raise_error
- expect( lambda { env['rack.input'] } ).to_not raise_error
- expect( lambda { env['rack.errors'] } ).to_not raise_error
- expect( lambda { env['rack.run_once'] } ).to_not raise_error
- expect( lambda { env['rack.multithread'] } ).to_not raise_error
- expect( lambda { env['java.servlet_context'] } ).to_not raise_error
- expect( lambda { env['java.servlet_request'] } ).to_not raise_error
- expect( lambda { env['java.servlet_response'] } ).to_not raise_error
+ expect { env['rack.version'] }.to_not raise_error
+ expect { env['rack.input'] }.to_not raise_error
+ expect { env['rack.errors'] }.to_not raise_error
+ expect { env['rack.run_once'] }.to_not raise_error
+ expect { env['rack.multithread'] }.to_not raise_error
+ expect { env['java.servlet_context'] }.to_not raise_error
+ expect { env['java.servlet_request'] }.to_not raise_error
+ expect { env['java.servlet_response'] }.to_not raise_error
Rack::Handler::Servlet::DefaultEnv::VARIABLES.each do |key|
lambda { env[key] }.should_not raise_error
env[key].should_not be(nil), "key: #{key.inspect} nil"
end
- expect( lambda { env['rack.whatever'] } ).to_not raise_error
+ expect { env['rack.whatever'] }.to_not raise_error
env['rack.whatever'].should be nil
- expect( lambda {
+ expect {
env['HTTP_X_FORWARDED_PROTO']
env['HTTP_IF_NONE_MATCH']
env['HTTP_IF_MODIFIED_SINCE']
env['HTTP_X_SOME_REALLY_LONG_HEADER']
- }).to_not raise_error
+ }.to_not raise_error
env['HTTP_X_FORWARDED_PROTO'].should_not be nil
env['HTTP_IF_NONE_MATCH'].should_not be nil
env['HTTP_IF_MODIFIED_SINCE'].should_not be nil
env['HTTP_X_SOME_REALLY_LONG_HEADER'].should_not be nil
- expect( lambda {
- env['HTTP_X_SOME_NON_EXISTENT_HEADER']
- }).to_not raise_error
+ expect { env['HTTP_X_SOME_NON_EXISTENT_HEADER'] }.to_not raise_error
env['HTTP_X_SOME_NON_EXISTENT_HEADER'].should be nil
end
diff --git a/src/spec/ruby/rack/jms_spec.rb b/src/spec/ruby/rack/jms_spec.rb
index 9455a521..e94c999d 100644
--- a/src/spec/ruby/rack/jms_spec.rb
+++ b/src/spec/ruby/rack/jms_spec.rb
@@ -7,9 +7,9 @@
require File.expand_path('spec_helper', File.dirname(__FILE__) + '/..')
-import org.jruby.rack.jms.QueueContextListener
-import org.jruby.rack.jms.QueueManager
-import org.jruby.rack.jms.DefaultQueueManager
+java_import org.jruby.rack.jms.QueueContextListener
+java_import org.jruby.rack.jms.QueueManager
+java_import org.jruby.rack.jms.DefaultQueueManager
describe QueueContextListener do
before :each do
diff --git a/src/spec/ruby/rack/servlet_context_listener_spec.rb b/src/spec/ruby/rack/servlet_context_listener_spec.rb
index c2cee5cb..9c2a57dc 100644
--- a/src/spec/ruby/rack/servlet_context_listener_spec.rb
+++ b/src/spec/ruby/rack/servlet_context_listener_spec.rb
@@ -46,9 +46,7 @@
@servlet_context.add_init_parameter 'jruby.rack.error', 'false'
@factory.should_receive(:init).and_raise org.jruby.rack.RackInitializationException.new("help")
- expect(lambda {
- @listener.contextInitialized servlet_context_event
- }).to raise_error(org.jruby.rack.RackInitializationException)
+ expect { @listener.contextInitialized servlet_context_event }.to raise_error(org.jruby.rack.RackInitializationException)
end
end
diff --git a/src/spec/ruby/rack/tag_spec.rb b/src/spec/ruby/rack/tag_spec.rb
index 167078e3..704a6303 100644
--- a/src/spec/ruby/rack/tag_spec.rb
+++ b/src/spec/ruby/rack/tag_spec.rb
@@ -69,7 +69,7 @@ def call(request)
end
it 'should override the path, query params, and http method of the request' do
- @application.should_receive(:call).and_return do |wrapped_request|
+ @application.should_receive(:call) do |wrapped_request|
wrapped_request.servlet_path.should == ""
wrapped_request.path_info.should == '/controller/action/id'
wrapped_request.query_string.should == 'fruit=apple&horse_before=cart'
diff --git a/src/spec/ruby/spec_helper.rb b/src/spec/ruby/spec_helper.rb
index b1650e28..650afbdf 100644
--- a/src/spec/ruby/spec_helper.rb
+++ b/src/spec/ruby/spec_helper.rb
@@ -57,21 +57,6 @@ def silence_warnings(&block)
JRuby::Rack::Helpers.silence_warnings(&block)
end
- def unwrap_native_exception(e)
- # JRuby 1.6.8 issue :
- # begin
- # ...
- # rescue org.jruby.rack.RackInitializationException => e
- # # e is still wrapped in a NativeException !
- # e.cause.class.name == 'org.jruby.rack.RackInitializationException'
- # end
- if JRUBY_VERSION < '1.7.0'
- e.is_a?(NativeException) ? e.cause : e
- else
- e
- end
- end
-
@@servlet_30 = nil
def servlet_30?
@@ -138,7 +123,7 @@ def should_eval_as_eql_to(code, expected, options = {})
runtime, options = options, {}
end
message = options[:message] || "expected eval #{code.inspect} to be == $expected but was $actual"
- be_flag = options.has_key?(:should) ? options[:should] : be_true
+ be_flag = options.has_key?(:should) ? options[:should] : be_truthy
expected = expected.inspect.to_java
actual = runtime.evalScriptlet(code).inspect.to_java
@@ -146,7 +131,7 @@ def should_eval_as_eql_to(code, expected, options = {})
end
def should_eval_as_not_eql_to(code, expected, options = {})
- should_eval_as_eql_to(code, expected, options.merge(:should => be_false,
+ should_eval_as_eql_to(code, expected, options.merge(:should => be_falsy,
:message => options[:message] || "expected eval #{code.inspect} to be != $expected but was not")
)
end
@@ -157,7 +142,7 @@ def should_eval_as_nil(code, runtime = @runtime)
end
def should_eval_as_not_nil(code, runtime = @runtime)
- should_eval_as_eql_to code, nil, :should => be_false, :runtime => runtime,
+ should_eval_as_eql_to code, nil, :should => be_falsy, :runtime => runtime,
:message => "expected eval #{code.inspect} to not be nil but was"
end
diff --git a/vendor/gems/bouncy-castle-java-1.5.0147.gem b/vendor/gems/bouncy-castle-java-1.5.0147.gem
deleted file mode 100644
index 03751478..00000000
Binary files a/vendor/gems/bouncy-castle-java-1.5.0147.gem and /dev/null differ
diff --git a/vendor/gems/jruby-openssl-0.9.4.gem b/vendor/gems/jruby-openssl-0.9.4.gem
deleted file mode 100644
index fc892593..00000000
Binary files a/vendor/gems/jruby-openssl-0.9.4.gem and /dev/null differ