ex_aequo_rspex 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 806920bd0da1fd090413ddea8adbc94635a2ff9b7ecd82bace50d6994751ad65
|
|
4
|
+
data.tar.gz: c390404d09110b108ff38fe91dd9bcd31a5946a5e5f3ebe71427562ffafd39e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f37abe9d9a62bd40d29ec8a3f2782c23b8cc04f633201bc4771dd34d893e8b6305a3a60d54bc11a5af4fb4632c382ec0149a7b8b57e3bd23c8dca35763e7363
|
|
7
|
+
data.tar.gz: c0ac88c6659de86df085a23a4e4c986dc1bedca10faa76407497763b5b777fdfd3ed468423ffb03e614541efda3bbcaa8dc777675ea1c2b6537bb9be2685d58c
|
|
@@ -85,17 +85,45 @@ module ExAequo
|
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
def it_raises(exception, message=nil, &blk)
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
def it_raises(exception, message=nil, **opts, &blk)
|
|
89
|
+
case opts.size
|
|
90
|
+
in 0
|
|
91
|
+
expect { blk ? instance_eval(&blk) : subject }
|
|
92
|
+
.to raise_error(exception, message)
|
|
93
|
+
in 1
|
|
94
|
+
raise ArgumentError, "must not provide message **and** custom method specification" unless message.nil?
|
|
95
|
+
_it_raises_custom(exception, opts.keys.first, opts.values.first, &blk)
|
|
96
|
+
in _
|
|
97
|
+
raise ArgumentError, "only one method specification for the raised exception allowed"
|
|
98
|
+
end
|
|
91
99
|
end
|
|
92
100
|
|
|
93
101
|
def it_puts(lines, to: $stdout, &blk)
|
|
94
|
-
lines.
|
|
95
|
-
|
|
102
|
+
lines = lines.dup
|
|
103
|
+
idx = 0
|
|
104
|
+
expect(to).to receive(:puts).with(anything).exactly(lines.count).times do |passed_in|
|
|
105
|
+
idx += 1
|
|
106
|
+
next if passed_in == lines[idx.pred]
|
|
107
|
+
|
|
108
|
+
msg = "line number #{idx}: expected: #{lines[idx.pred].inspect}, was: #{passed_in.inspect}"
|
|
109
|
+
raise RSpec::Expectations::ExpectationNotMetError,msg
|
|
96
110
|
end
|
|
97
111
|
blk ? instance_eval(&blk) : subject
|
|
98
112
|
end
|
|
113
|
+
|
|
114
|
+
private
|
|
115
|
+
def _it_raises_custom(exception, mthd, value, &blk)
|
|
116
|
+
begin
|
|
117
|
+
blk.()
|
|
118
|
+
message = "the expected exception #{exception} was not raised"
|
|
119
|
+
raise RSpec::Expectations::ExpectationNotMetError, message
|
|
120
|
+
rescue exception => e
|
|
121
|
+
expect(e.send(mthd)).to eq(value)
|
|
122
|
+
rescue Exception => e
|
|
123
|
+
message = "instead of the expected exception #{exception}, #{e.inspect} was raised"
|
|
124
|
+
raise RSpec::Expectations::ExpectationNotMetError, message
|
|
125
|
+
end
|
|
126
|
+
end
|
|
99
127
|
end
|
|
100
128
|
end
|
|
101
129
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ex_aequo_rspex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Dober
|
|
@@ -50,14 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 4.0.
|
|
53
|
+
version: 4.0.2
|
|
54
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
requirements:
|
|
56
56
|
- - ">="
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
58
|
version: '0'
|
|
59
59
|
requirements: []
|
|
60
|
-
rubygems_version: 4.0.
|
|
60
|
+
rubygems_version: 4.0.10
|
|
61
61
|
specification_version: 4
|
|
62
62
|
summary: RSpec macros and helpers
|
|
63
63
|
test_files: []
|