Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit c39e878

Browse files
committed
Disable outrun in a way that does not generate a warning when rspec/autorun gets loaded.
This is necessary to get the JRuby 9.1.2.0 build passing with the `--dev` flag.
1 parent 6d32a9f commit c39e878

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

spec/rspec/core_spec.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
# JRuby appears to not respect `--disable=gem` so rubygems also gets loaded.
1414
allowed_loaded_features << /rubygems/ if RSpec::Support::Ruby.jruby?
1515

16+
disable_autorun_code =
17+
if RSpec::Support::OS.windows?
18+
# On Windows, the "redefine autorun" approach results in a different
19+
# exit status for a reason I don't understand, so we just disable
20+
# autorun outright.
21+
'RSpec::Core::Runner.disable_autorun!'
22+
else
23+
# On JRuby, the `disable_autorun!` approach leads to a stderr warning
24+
# related to a deprecation emited when `rspec/core/autorun` gets loaded,
25+
# because of `caller_filter` issues, so we redefine the autorun method
26+
# instead. That works fine on all Rubies when we're not on Windows as
27+
# well.
28+
'RSpec::Core::Runner.instance_exec { undef :autorun; def autorun; end }'
29+
end
30+
1631
it_behaves_like 'library wide checks', 'rspec-core',
1732
:preamble_for_lib => [
1833
# rspec-core loads a number of external libraries. We don't want them loaded
@@ -51,7 +66,7 @@
5166
# Many files assume this has already been loaded and will have errors if it has not.
5267
'require "rspec/core"',
5368
# Prevent rspec/autorun from trying to run RSpec.
54-
'RSpec::Core::Runner.disable_autorun!'
69+
disable_autorun_code
5570
], :skip_spec_files => %r{/fake_libs/}, :allowed_loaded_feature_regexps => allowed_loaded_features do
5671
if RUBY_VERSION == '1.8.7'
5772
before(:example, :description => /(issues no warnings when the spec files are loaded|stdlibs)/) do

0 commit comments

Comments
 (0)