This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 13
13
# JRuby appears to not respect `--disable=gem` so rubygems also gets loaded.
14
14
allowed_loaded_features << /rubygems/ if RSpec ::Support ::Ruby . jruby?
15
15
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
+
16
31
it_behaves_like 'library wide checks' , 'rspec-core' ,
17
32
:preamble_for_lib => [
18
33
# rspec-core loads a number of external libraries. We don't want them loaded
51
66
# Many files assume this has already been loaded and will have errors if it has not.
52
67
'require "rspec/core"' ,
53
68
# Prevent rspec/autorun from trying to run RSpec.
54
- 'RSpec::Core::Runner.disable_autorun!'
69
+ disable_autorun_code
55
70
] , :skip_spec_files => %r{/fake_libs/} , :allowed_loaded_feature_regexps => allowed_loaded_features do
56
71
if RUBY_VERSION == '1.8.7'
57
72
before ( :example , :description => /(issues no warnings when the spec files are loaded|stdlibs)/ ) do
You can’t perform that action at this time.
0 commit comments