rspec-expectations 3.4.0 → 3.5.0.beta1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +18 -0
- data/lib/rspec/expectations/handler.rb +1 -1
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers/built_in/be.rb +6 -3
- data/lib/rspec/matchers/built_in/raise_error.rb +9 -5
- data/lib/rspec/matchers/dsl.rb +8 -2
- metadata +10 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c2b975192766df01f56f479ba2bf0ded3d6d4a
|
4
|
+
data.tar.gz: da2cd30524e919d4a790636f81ff1e785d876474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0af3c1a4f19bcd46ecbb103e235db61c518307ef410e33574151cd3fa1c6774db6cad1efb3120c4921e59fb609145a09864ee558abf80141ccd08753655a0448
|
7
|
+
data.tar.gz: cf16751b9bc189992934d343c557ed21964d54991d70619babe415fd724f305749cddb960a9d1346f36417b62f912ec6526b0f8cfa9ff1e417fa214771d2930f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
### 3.5.0 Development
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.5.0.beta1...master)
|
3
|
+
|
4
|
+
### 3.5.0.beta1 / 2016-02-06
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.4.0...v3.5.0.beta1)
|
6
|
+
|
7
|
+
Enhancements:
|
8
|
+
|
9
|
+
* Make `match_when_negated` in custom matcher DSL support use of
|
10
|
+
expectations within the match logic. (Chris Arcand, #789)
|
11
|
+
|
12
|
+
Bug Fixes:
|
13
|
+
|
14
|
+
* Return `true` as expected from passing negated expectations
|
15
|
+
(such as `expect("foo").not_to eq "bar"`), so they work
|
16
|
+
properly when used within a `match` or `match_when_negated`
|
17
|
+
block. (Chris Arcand, #789)
|
18
|
+
|
1
19
|
### 3.4.0 / 2015-11-11
|
2
20
|
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.3.1...v3.4.0)
|
3
21
|
|
@@ -69,7 +69,7 @@ module RSpec
|
|
69
69
|
def self.handle_matcher(actual, initial_matcher, message=nil, &block)
|
70
70
|
ExpectationHelper.with_matcher(self, initial_matcher, message) do |matcher|
|
71
71
|
return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) unless initial_matcher
|
72
|
-
|
72
|
+
does_not_match?(matcher, actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message_when_negated)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -137,7 +137,8 @@ module RSpec
|
|
137
137
|
include BeHelpers
|
138
138
|
|
139
139
|
def initialize(operand, operator)
|
140
|
-
@expected
|
140
|
+
@expected = operand
|
141
|
+
@operator = operator
|
141
142
|
@args = []
|
142
143
|
end
|
143
144
|
|
@@ -151,13 +152,15 @@ module RSpec
|
|
151
152
|
# @api private
|
152
153
|
# @return [String]
|
153
154
|
def failure_message
|
154
|
-
"expected: #{@operator} #{expected_formatted}\n
|
155
|
+
"expected: #{@operator} #{expected_formatted}\n" \
|
156
|
+
" got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}"
|
155
157
|
end
|
156
158
|
|
157
159
|
# @api private
|
158
160
|
# @return [String]
|
159
161
|
def failure_message_when_negated
|
160
|
-
message = "`expect(#{actual_formatted}).not_to
|
162
|
+
message = "`expect(#{actual_formatted}).not_to " \
|
163
|
+
"be #{@operator} #{expected_formatted}`"
|
161
164
|
if [:<, :>, :<=, :>=].include?(@operator)
|
162
165
|
message + " not only FAILED, it is a bit confusing."
|
163
166
|
else
|
@@ -12,7 +12,8 @@ module RSpec
|
|
12
12
|
def initialize(expected_error_or_message=nil, expected_message=nil, &block)
|
13
13
|
@block = block
|
14
14
|
@actual_error = nil
|
15
|
-
@warn_about_bare_error = warn_about_potential_false_positives? &&
|
15
|
+
@warn_about_bare_error = warn_about_potential_false_positives? &&
|
16
|
+
expected_error_or_message.nil?
|
16
17
|
|
17
18
|
case expected_error_or_message
|
18
19
|
when nil
|
@@ -162,8 +163,9 @@ module RSpec
|
|
162
163
|
"without even executing the method you are intending to call. " \
|
163
164
|
"#{warning}"\
|
164
165
|
"Instead consider providing a specific error class or message. " \
|
165
|
-
"This message can be
|
166
|
-
"`RSpec::Expectations.configuration.
|
166
|
+
"This message can be suppressed by setting: " \
|
167
|
+
"`RSpec::Expectations.configuration.warn_about_potential_false" \
|
168
|
+
"_positives = false`")
|
167
169
|
end
|
168
170
|
|
169
171
|
def warn_about_negative_false_positive(expression)
|
@@ -172,8 +174,10 @@ module RSpec
|
|
172
174
|
"including those raised by Ruby (e.g. NoMethodError, NameError " \
|
173
175
|
"and ArgumentError), meaning the code you are intending to test " \
|
174
176
|
"may not even get reached. Instead consider using " \
|
175
|
-
"`expect {}.not_to raise_error
|
176
|
-
"
|
177
|
+
"`expect {}.not_to raise_error` or `expect { }.to raise_error" \
|
178
|
+
"(DifferentSpecificErrorClass)`. This message can be suppressed by " \
|
179
|
+
"setting: `RSpec::Expectations.configuration.warn_about_potential_false" \
|
180
|
+
"_positives = false`")
|
177
181
|
end
|
178
182
|
|
179
183
|
def expected_error
|
data/lib/rspec/matchers/dsl.rb
CHANGED
@@ -80,8 +80,14 @@ module RSpec
|
|
80
80
|
# @yield [Object] actual the actual value (i.e. the value wrapped by `expect`)
|
81
81
|
def match_when_negated(&match_block)
|
82
82
|
define_user_override(:does_not_match?, match_block) do |actual|
|
83
|
-
|
84
|
-
|
83
|
+
begin
|
84
|
+
@actual = actual
|
85
|
+
RSpec::Support.with_failure_notifier(RAISE_NOTIFIER) do
|
86
|
+
super(*actual_arg_for(match_block))
|
87
|
+
end
|
88
|
+
rescue RSpec::Expectations::ExpectationNotMetError
|
89
|
+
false
|
90
|
+
end
|
85
91
|
end
|
86
92
|
end
|
87
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -45,22 +45,22 @@ cert_chain:
|
|
45
45
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
46
46
|
F3MdtaDehhjC
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date:
|
48
|
+
date: 2016-02-06 00:00:00.000000000 Z
|
49
49
|
dependencies:
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rspec-support
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.
|
56
|
+
version: 3.5.0.beta1
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 3.
|
63
|
+
version: 3.5.0.beta1
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: diff-lcs
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +212,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: 1.8.7
|
213
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
|
-
- - "
|
215
|
+
- - ">"
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version:
|
217
|
+
version: 1.3.1
|
218
218
|
requirements: []
|
219
219
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.4.5.1
|
221
221
|
signing_key:
|
222
222
|
specification_version: 4
|
223
|
-
summary: rspec-expectations-3.
|
223
|
+
summary: rspec-expectations-3.5.0.beta1
|
224
224
|
test_files: []
|
225
225
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|