1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-01-28 20:47:46 +01:00
parent 6321a68582
commit ed377cc9aa
3 changed files with 11 additions and 1 deletions

View file

@ -28,6 +28,7 @@ class ContextState
@pre = {}
@post = {}
@examples = []
@state = nil
@parent = nil
@parents = [self]
@children = []
@ -127,6 +128,7 @@ class ContextState
# Creates an ExampleState instance for the block and stores it
# in a list of examples to evaluate unless the example is filtered.
def it(desc, &block)
raise "nested #it" if @state
example = ExampleState.new(self, desc, block)
MSpec.actions :add, example
return if MSpec.guarded?

View file

@ -16,6 +16,10 @@ if RUBY_ENGINE == "ruby" and ruby_version_is("2.4")
end
def Warning.warn(message)
# Suppress any warning inside the method to prevent recursion
verbose = $VERBOSE
$VERBOSE = nil
if Thread.current[:in_mspec_complain_matcher]
return $stderr.write(message)
end
@ -52,9 +56,12 @@ if RUBY_ENGINE == "ruby" and ruby_version_is("2.4")
when /env\/shared\/key\.rb:\d+: warning: ENV\.index is deprecated; use ENV\.key/
when /exponent(_spec)?\.rb:\d+: warning: in a\*\*b, b may be too big/
when /enumerator\/(new_spec|initialize_spec)\.rb:\d+: warning: Enumerator\.new without a block is deprecated/
when /Pattern matching is experimental, and the behavior may change in future versions of Ruby!/
else
$stderr.write message
end
ensure
$VERBOSE = verbose
end
else
$VERBOSE = nil unless ENV['OUTPUT_WARNINGS']

View file

@ -157,7 +157,8 @@ end
def test_new_specs
require "yaml"
Dir.chdir(SOURCE_REPO) do
versions = YAML.load_file("#{MSPEC_REPO}/.travis.yml").fetch("rvm")
workflow = YAML.load_file(".github/workflows/ci.yml")
versions = workflow.dig("jobs", "test", "strategy", "matrix", "ruby")
versions = versions.grep(/^\d+\./) # Test on MRI
min_version, max_version = versions.minmax