rspec-matcher 0.1.4 → 0.1.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
  SHA1:
3
- metadata.gz: 7532489552ab193eb37e60fa4ce1842d8c0f4930
4
- data.tar.gz: 6272b0ed34cfbfae5e47027beba52ed09a842ef1
3
+ metadata.gz: 5e58f8fff44a02ee2b93cfb9f31d7fbfb60f0d61
4
+ data.tar.gz: e1958535cc48ee8885596a3453773cc4dac00dbe
5
5
  SHA512:
6
- metadata.gz: 8051875b6eccdfee13f989e4ac44f96ef241bed02b7c82adc72f7331653ea149c9d706915f11493c66afd22679c5ec3df173fe46317db40ca15f6311660784a8
7
- data.tar.gz: 635c5c03852de53e9ee053ac664b1905f8ceda58f8c3a0150d4eb66c016f81967601160a0af992c3dd901274a38bb2f0f9ca990d1bf49493ba6b94ff4135cc3d
6
+ metadata.gz: f8a40a8a74fcebe2f73a48dd7e0eaa809ec5016f73c5ad10c2603cea9aadf72c4fb9c165bec5432ba58b29373265a2d26c2bc284810b0bf5577b78ba821a3b32
7
+ data.tar.gz: d8acb51ff60a031548707d81f57b5bcf90c36b32ccb7e0819ceca933b8f346b057c71d49e4b5f41b3bc7229e98ac23199d03068d62f4cf4044b31b5b9629f0cb
@@ -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
- raise "not implemented"
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
- raise "not implemented"
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
 
@@ -12,7 +12,7 @@ module RSpec
12
12
  end
13
13
 
14
14
  def self.version
15
- "0.1.4"
15
+ "0.1.5"
16
16
  end
17
17
 
18
18
  def self.version_label
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
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-19 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport