rspec-matcher 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec/matcher.rb +11 -4
- data/lib/rspec/matcher/identity.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e58f8fff44a02ee2b93cfb9f31d7fbfb60f0d61
|
4
|
+
data.tar.gz: e1958535cc48ee8885596a3453773cc4dac00dbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a40a8a74fcebe2f73a48dd7e0eaa809ec5016f73c5ad10c2603cea9aadf72c4fb9c165bec5432ba58b29373265a2d26c2bc284810b0bf5577b78ba821a3b32
|
7
|
+
data.tar.gz: d8acb51ff60a031548707d81f57b5bcf90c36b32ccb7e0819ceca933b8f346b057c71d49e4b5f41b3bc7229e98ac23199d03068d62f4cf4044b31b5b9629f0cb
|
data/lib/rspec/matcher.rb
CHANGED
@@ -39,7 +39,8 @@ module RSpec
|
|
39
39
|
included do
|
40
40
|
prepend RSpec::Matcher::PrependedMethods
|
41
41
|
|
42
|
-
attr_accessor :expected, :actual
|
42
|
+
attr_accessor :expected, :actual, :_message
|
43
|
+
private :_message, :_message=
|
43
44
|
end
|
44
45
|
|
45
46
|
# @api private
|
@@ -171,6 +172,7 @@ module RSpec
|
|
171
172
|
# @example match X regex
|
172
173
|
# @note for composable matchers
|
173
174
|
# @note raises by default
|
175
|
+
# @note used for failure messages
|
174
176
|
# @return [String]
|
175
177
|
def description
|
176
178
|
raise "not implemented"
|
@@ -182,7 +184,9 @@ module RSpec
|
|
182
184
|
# @note raises by default
|
183
185
|
# @return [String]
|
184
186
|
def failure_message
|
185
|
-
|
187
|
+
return "Expected #{expected} to #{description}" if _message == UNDEFINED
|
188
|
+
|
189
|
+
"Expected #{expected} to #{description} but #{_message}"
|
186
190
|
end
|
187
191
|
|
188
192
|
# Describe failure when not_to is used.
|
@@ -191,7 +195,7 @@ module RSpec
|
|
191
195
|
# @note raises by default
|
192
196
|
# @return [String]
|
193
197
|
def failure_message_when_negated
|
194
|
-
|
198
|
+
failure_message.sub "to", "not to"
|
195
199
|
end
|
196
200
|
|
197
201
|
# Indicates if actual and expected should be diffed on failure.
|
@@ -227,8 +231,11 @@ module RSpec
|
|
227
231
|
# @api public
|
228
232
|
# Stops evaluation and tells RSpec there wasn't a match.
|
229
233
|
# @throw :resolution
|
234
|
+
# @note message is used in failure messages
|
235
|
+
# @param [String] message reason expectation was rejected
|
230
236
|
# @return [void]
|
231
|
-
def reject_expectation
|
237
|
+
def reject_expectation message = UNDEFINED
|
238
|
+
self._message = message
|
232
239
|
throw :resolution, false
|
233
240
|
end
|
234
241
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pooyan Khosravi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|