Skip to content

Commit d9fa998

Browse files
committed
Re-enable specs to run with included JRuby bundler
Signed-off-by: Chad Wilson <[email protected]>
1 parent a965a33 commit d9fa998

11 files changed

+39
-71
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ DEPENDENCIES
3131
rspec
3232

3333
BUNDLED WITH
34-
2.4.19
34+
2.3.26

Rakefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ task :unpack_gem => "target" do |t|
6464
mkdir_p "target/vendor"
6565
require 'rubygems/installer'
6666
rack_dir = File.basename(gem_file).sub(/\.gem$/, '')
67-
Gem::Installer.new(Gem::Package.new(gem_file), :unpack => true, :install_dir => rack_dir).unpack "#{target}/#{rack_dir}"
67+
Gem::Package.new(gem_file).extract_files("#{target}/#{rack_dir}")
6868
File.open("#{target}/vendor/rack.rb", "w") do |f|
6969
f << "dir = File.dirname(__FILE__)\n"
7070
f << "if dir =~ /.jar!/ && dir !~ /^file:/\n"
@@ -109,8 +109,9 @@ task :speconly => [ :resources, :test_resources ] do
109109
opts = ENV['SPEC_OPTS'] ? ENV['SPEC_OPTS'] : %q{ --format documentation --color }
110110
spec = ENV['SPEC'] || File.join(Dir.getwd, "src/spec/ruby/**/*_spec.rb")
111111
opts = opts.split(' ').push *FileList[spec].to_a
112-
exec = 'rspec'; exec = Gem.bin_path('rspec', exec) if ENV['FULL_BIN_PATH']
113-
ruby "-Isrc/spec/ruby", "-rbundler/setup", "-S", exec, *opts
112+
113+
args = ENV['RUBY'].split(' ') + %w{-Isrc/spec/ruby -rbundler/setup -S rspec}
114+
sh *args, *opts
114115
end
115116
end
116117

pom.xml

+16-50
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
<properties>
2222
<jruby.version>9.4.7.0</jruby.version>
23-
<vendor.gems.path>vendor/gems</vendor.gems.path>
24-
<bundler.version>2.4.19</bundler.version>
25-
<bundler.local>false</bundler.local> <!-- true by default -->
2623
<jruby.maven.plugins.version>3.0.3</jruby.maven.plugins.version>
2724
<gem.home>${project.build.directory}/rubygems</gem.home>
2825
</properties>
@@ -97,6 +94,7 @@
9794
<groupId>org.jruby</groupId>
9895
<artifactId>jruby-core</artifactId>
9996
<version>${jruby.version}</version>
97+
<scope>provided</scope>
10098
</dependency>
10199
<!-- JavaEE 6 APIs -->
102100
<dependency>
@@ -147,24 +145,11 @@
147145
<version>3.2.10.RELEASE</version>
148146
<scope>test</scope>
149147
</dependency>
150-
<dependency>
151-
<groupId>rubygems</groupId>
152-
<artifactId>jruby-openssl</artifactId>
153-
<version>0.9.6</version>
154-
<type>gem</type>
155-
<scope>provided</scope>
156-
</dependency>
157-
<dependency>
158-
<groupId>rubygems</groupId>
159-
<artifactId>bundler</artifactId>
160-
<version>${bundler.version}</version>
161-
<type>gem</type>
162-
<scope>provided</scope>
163-
</dependency>
164148
<dependency>
165149
<groupId>javax.activation</groupId>
166150
<artifactId>activation</artifactId>
167151
<version>1.1</version>
152+
<scope>test</scope>
168153
</dependency>
169154
</dependencies>
170155

@@ -233,26 +218,6 @@
233218
</execution>
234219
</executions>
235220
</plugin>
236-
<plugin>
237-
<groupId>org.jruby.maven</groupId>
238-
<artifactId>gem-maven-plugin</artifactId>
239-
<version>${jruby.maven.plugins.version}</version>
240-
<configuration>
241-
<includeOpenSSL>false</includeOpenSSL>
242-
<gemHomes>
243-
<provided>${gem.home}</provided>
244-
</gemHomes>
245-
</configuration>
246-
<executions>
247-
<execution>
248-
<id>gem-install-bundler</id>
249-
<phase>test</phase>
250-
<goals>
251-
<goal>initialize</goal>
252-
</goals>
253-
</execution>
254-
</executions>
255-
</plugin>
256221
<plugin>
257222
<groupId>org.jruby.maven</groupId>
258223
<artifactId>bundler-maven-plugin</artifactId>
@@ -263,9 +228,9 @@
263228
<phase>test</phase>
264229
<goals><goal>install</goal></goals>
265230
<configuration>
266-
<jruby.version>${jruby.version}</jruby.version>
267-
<!--<local>false</local>-->
268-
<bundlerVersion>${bundler.version}</bundlerVersion>
231+
<jrubyVersion>${jruby.version}</jrubyVersion>
232+
<local>false</local>
233+
<quiet>false</quiet>
269234
</configuration>
270235
</execution>
271236
</executions>
@@ -274,24 +239,25 @@
274239
<groupId>org.jruby.maven</groupId>
275240
<artifactId>rake-maven-plugin</artifactId>
276241
<version>${jruby.maven.plugins.version}</version>
242+
<configuration>
243+
<jrubyVersion>${jruby.version}</jrubyVersion>
244+
</configuration>
277245
<executions>
278-
<!-- <execution>-->
279-
<!-- <id>rake-spec</id>-->
280-
<!-- <phase>test</phase>-->
281-
<!-- <goals><goal>rake</goal></goals>-->
282-
<!-- <configuration>-->
283-
<!-- <jruby.version>${jruby.version}</jruby.version>-->
284-
<!-- <args>speconly SKIP_SPECS=${maven.test.skip} FULL_BIN_PATH=true</args>-->
285-
<!-- </configuration>-->
286-
<!-- </execution>-->
246+
<execution>
247+
<id>rake-spec</id>
248+
<phase>test</phase>
249+
<goals><goal>rake</goal></goals>
250+
<configuration>
251+
<args>speconly SKIP_SPECS=${maven.test.skip}</args>
252+
</configuration>
253+
</execution>
287254
<execution>
288255
<!-- additional (ruby) generated resources -->
289256
<id>rake-resources</id>
290257
<phase>prepare-package</phase>
291258
<!-- bind "late" so we do not run during compile/test-compile -->
292259
<goals><goal>rake</goal></goals>
293260
<configuration>
294-
<jruby.version>${jruby.version}</jruby.version>
295261
<args>resources VERSION=${project.version}</args>
296262
</configuration>
297263
</execution>

src/spec/ruby/jruby/rack/app_layout_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@
8989

9090
shared_examples "FileSystemLayout" do
9191

92-
@@__work_dir__ = Dir.pwd
92+
@original_work_dir = Dir.pwd
9393

9494
before do
9595
require 'tmpdir'
9696
Dir.chdir Dir.mktmpdir
9797
end
9898

9999
after do
100-
Dir.chdir @@__work_dir__
100+
Dir.chdir @original_work_dir
101101
end
102102

103103
it "sets app and public uri defaults based on a typical (Rails/Rack) app" do

src/spec/ruby/jruby/rack/booter_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
after(:all) { JRuby::Rack.context = nil }
1818

19-
@@rack_env = ENV['RACK_ENV']
20-
@@gem_path = Gem.path.dup
21-
@@env_gem_path = ENV['GEM_PATH']
19+
@rack_env = ENV['RACK_ENV']
20+
@gem_path = Gem.path.dup
21+
@env_gem_path = ENV['GEM_PATH']
2222

2323
after do
24-
@@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @@rack_env
25-
Gem.path.replace(@@gem_path)
26-
@@env_gem_path.nil? ? ENV.delete('GEM_PATH') : ENV['GEM_PATH'] = @@env_gem_path
24+
@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @rack_env
25+
Gem.path.replace(@gem_path)
26+
@env_gem_path.nil? ? ENV.delete('GEM_PATH') : ENV['GEM_PATH'] = @env_gem_path
2727
end
2828

2929
it "should determine the public html root from the 'public.root' init parameter" do

src/spec/ruby/jruby/rack/integration_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def expect_to_have_monkey_patched_chunked
423423
should_eval_as_eql_to script, "1\nsecond"
424424
end
425425

426-
ENV_COPY = ENV.dup
426+
ENV_COPY = ENV.to_h
427427

428428
def initialize_rails(env = nil, servlet_context = @servlet_context)
429429
if ! servlet_context || servlet_context.is_a?(String)

src/spec/ruby/jruby/rack/rails_booter_spec.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
booter.app_path.should == "./WEB-INF"
2626
end
2727

28-
@@rails_env = ENV['RAILS_ENV']; @@rack_env = ENV['RACK_ENV']
28+
@rails_env = ENV['RAILS_ENV']
29+
@rack_env = ENV['RACK_ENV']
2930

3031
after do
31-
@@rails_env.nil? ? ENV.delete('RAILS_ENV') : ENV['RAILS_ENV'] = @@rails_env
32-
@@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @@rack_env
32+
@rails_env.nil? ? ENV.delete('RAILS_ENV') : ENV['RAILS_ENV'] = @rails_env
33+
@rack_env.nil? ? ENV.delete('RACK_ENV') : ENV['RACK_ENV'] = @rack_env
3334
end
3435

3536
it "should default rails path to /WEB-INF" do

src/spec/ruby/jruby/rack/response_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,11 @@ def with_swallow_client_abort(client_abort = true)
526526

527527
private
528528

529-
def update_response_headers(headers, response = response)
529+
def update_response_headers(headers, response)
530530
response.to_java.getHeaders.update(headers)
531531
end
532532

533-
def new_response_environment(servlet_response = servlet_response)
533+
def new_response_environment(servlet_response)
534534
org.jruby.rack.RackResponseEnvironment.impl do |name, *args|
535535
servlet_response.send(name, *args)
536536
end

src/spec/ruby/rack/jms_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
require File.expand_path('spec_helper', File.dirname(__FILE__) + '/..')
99

10-
import org.jruby.rack.jms.QueueContextListener
11-
import org.jruby.rack.jms.QueueManager
12-
import org.jruby.rack.jms.DefaultQueueManager
10+
java_import org.jruby.rack.jms.QueueContextListener
11+
java_import org.jruby.rack.jms.QueueManager
12+
java_import org.jruby.rack.jms.DefaultQueueManager
1313

1414
describe QueueContextListener do
1515
before :each do
-2.06 MB
Binary file not shown.

vendor/gems/jruby-openssl-0.9.4.gem

-501 KB
Binary file not shown.

0 commit comments

Comments
 (0)