Skip to content

Commit 35a9daa

Browse files
committed
[GR-29721] Update mspec to get the fix for raise_error() do
PullRequest: truffleruby/2465
2 parents eba171e + b7abda3 commit 35a9daa

File tree

118 files changed

+3219
-3126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3219
-3126
lines changed

spec/mspec/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

33
gem "rake", "~> 12.3"
4-
gem "rspec", "~> 2.14.1"
4+
gem "rspec", "~> 3.0"

spec/mspec/Gemfile.lock

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
diff-lcs (1.3)
4+
diff-lcs (1.4.4)
55
rake (12.3.3)
6-
rspec (2.14.1)
7-
rspec-core (~> 2.14.0)
8-
rspec-expectations (~> 2.14.0)
9-
rspec-mocks (~> 2.14.0)
10-
rspec-core (2.14.8)
11-
rspec-expectations (2.14.5)
12-
diff-lcs (>= 1.1.3, < 2.0)
13-
rspec-mocks (2.14.6)
6+
rspec (3.10.0)
7+
rspec-core (~> 3.10.0)
8+
rspec-expectations (~> 3.10.0)
9+
rspec-mocks (~> 3.10.0)
10+
rspec-core (3.10.1)
11+
rspec-support (~> 3.10.0)
12+
rspec-expectations (3.10.1)
13+
diff-lcs (>= 1.2.0, < 2.0)
14+
rspec-support (~> 3.10.0)
15+
rspec-mocks (3.10.2)
16+
diff-lcs (>= 1.2.0, < 2.0)
17+
rspec-support (~> 3.10.0)
18+
rspec-support (3.10.2)
1419

1520
PLATFORMS
1621
java
1722
ruby
1823

1924
DEPENDENCIES
2025
rake (~> 12.3)
21-
rspec (~> 2.14.1)
26+
rspec (~> 3.0)

spec/mspec/lib/mspec/expectations/should.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Object
22
NO_MATCHER_GIVEN = Object.new
33

4-
def should(matcher = NO_MATCHER_GIVEN)
4+
def should(matcher = NO_MATCHER_GIVEN, &block)
55
MSpec.expectation
66
state = MSpec.current.state
77
raise "should outside example" unless state
@@ -10,14 +10,17 @@ def should(matcher = NO_MATCHER_GIVEN)
1010
if NO_MATCHER_GIVEN.equal?(matcher)
1111
SpecPositiveOperatorMatcher.new(self)
1212
else
13+
# The block was given to #should syntactically, but it was intended for a matcher like #raise_error
14+
matcher.block = block if block
15+
1316
unless matcher.matches? self
1417
expected, actual = matcher.failure_message
1518
SpecExpectation.fail_with(expected, actual)
1619
end
1720
end
1821
end
1922

20-
def should_not(matcher = NO_MATCHER_GIVEN)
23+
def should_not(matcher = NO_MATCHER_GIVEN, &block)
2124
MSpec.expectation
2225
state = MSpec.current.state
2326
raise "should_not outside example" unless state
@@ -26,6 +29,9 @@ def should_not(matcher = NO_MATCHER_GIVEN)
2629
if NO_MATCHER_GIVEN.equal?(matcher)
2730
SpecNegativeOperatorMatcher.new(self)
2831
else
32+
# The block was given to #should_not syntactically, but it was intended for the matcher
33+
matcher.block = block if block
34+
2935
if matcher.matches? self
3036
expected, actual = matcher.negative_failure_message
3137
SpecExpectation.fail_with(expected, actual)

spec/mspec/lib/mspec/matchers/raise_error.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class RaiseErrorMatcher
2+
attr_writer :block
3+
24
def initialize(exception, message, &block)
35
@exception = exception
46
@message = message

spec/mspec/lib/mspec/runner/formatters/junit.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def finish
2424
errors = @tally.counter.errors
2525
failures = @tally.counter.failures
2626

27-
printf <<-XML
27+
print <<-XML
2828
2929
<?xml version="1.0" encoding="UTF-8" ?>
3030
<testsuites
@@ -42,8 +42,8 @@ def finish
4242
@tests.each do |h|
4343
description = encode_for_xml h[:test].description
4444

45-
printf <<-XML, "Spec", description, 0.0
46-
<testcase classname="%s" name="%s" time="%f">
45+
print <<-XML
46+
<testcase classname="Spec" name="#{description}" time="0.0">
4747
XML
4848
if h[:exception]
4949
outcome = h[:test].failure? ? "failure" : "error"

0 commit comments

Comments
 (0)