summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/mspec/lib/mspec/runner/context.rb2
-rw-r--r--spec/mspec/lib/mspec/utils/warnings.rb7
-rw-r--r--spec/mspec/tool/sync/sync-rubyspec.rb3
3 files changed, 11 insertions, 1 deletions
diff --git a/spec/mspec/lib/mspec/runner/context.rb b/spec/mspec/lib/mspec/runner/context.rb
index 5f6c9c8ae9..d55b0dcd9e 100644
--- a/spec/mspec/lib/mspec/runner/context.rb
+++ b/spec/mspec/lib/mspec/runner/context.rb
@@ -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?
diff --git a/spec/mspec/lib/mspec/utils/warnings.rb b/spec/mspec/lib/mspec/utils/warnings.rb
index 7c2bc6fe88..1cf83b6d22 100644
--- a/spec/mspec/lib/mspec/utils/warnings.rb
+++ b/spec/mspec/lib/mspec/utils/warnings.rb
@@ -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']
diff --git a/spec/mspec/tool/sync/sync-rubyspec.rb b/spec/mspec/tool/sync/sync-rubyspec.rb
index 74881c1a77..d78277414e 100644
--- a/spec/mspec/tool/sync/sync-rubyspec.rb
+++ b/spec/mspec/tool/sync/sync-rubyspec.rb
@@ -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