summaryrefslogtreecommitdiff
path: root/spec/mspec
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-12-27 17:36:04 +0100
committerBenoit Daloze <eregontp@gmail.com>2019-12-27 17:36:04 +0100
commit74fdc1e60fb8ba03f5cdb09866c75bbe5dbce936 (patch)
treebc9dc6d54634cce8aa6ca043d6ac3fdb98ff123e /spec/mspec
parentfe3d9d2832cd34cfbc618472bf2e3f0c1979a0a4 (diff)
Update to ruby/mspec@673fcab
Diffstat (limited to 'spec/mspec')
-rw-r--r--spec/mspec/lib/mspec/expectations/should.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/mspec/lib/mspec/expectations/should.rb b/spec/mspec/lib/mspec/expectations/should.rb
index 231ad15c21..ca0617484c 100644
--- a/spec/mspec/lib/mspec/expectations/should.rb
+++ b/spec/mspec/lib/mspec/expectations/should.rb
@@ -3,7 +3,10 @@ class Object
def should(matcher = NO_MATCHER_GIVEN)
MSpec.expectation
- MSpec.actions :expectation, MSpec.current.state
+ state = MSpec.current.state
+ raise "should outside example" unless state
+ MSpec.actions :expectation, state
+
if NO_MATCHER_GIVEN.equal?(matcher)
SpecPositiveOperatorMatcher.new(self)
else
@@ -16,7 +19,10 @@ class Object
def should_not(matcher = NO_MATCHER_GIVEN)
MSpec.expectation
- MSpec.actions :expectation, MSpec.current.state
+ state = MSpec.current.state
+ raise "should_not outside example" unless state
+ MSpec.actions :expectation, state
+
if NO_MATCHER_GIVEN.equal?(matcher)
SpecNegativeOperatorMatcher.new(self)
else