rspec-expectations 2.14.5 → 2.99.0
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 +15 -7
- data/Changelog.md +114 -31
- data/features/README.md +2 -1
- data/features/built_in_matchers/be.feature +40 -40
- data/features/step_definitions/additional_cli_steps.rb +10 -0
- data/features/test_frameworks/test_unit.feature +40 -0
- data/lib/rspec/expectations/caller_filter.rb +60 -0
- data/lib/rspec/{matchers → expectations}/configuration.rb +5 -3
- data/lib/rspec/expectations/deprecation.rb +11 -15
- data/lib/rspec/expectations/expectation_target.rb +75 -8
- data/lib/rspec/expectations/handler.rb +5 -1
- data/lib/rspec/expectations/syntax.rb +3 -5
- data/lib/rspec/expectations/version.rb +1 -2
- data/lib/rspec/expectations.rb +1 -1
- data/lib/rspec/matchers/be_close.rb +4 -1
- data/lib/rspec/matchers/built_in/base_matcher.rb +10 -5
- data/lib/rspec/matchers/built_in/be.rb +38 -9
- data/lib/rspec/matchers/built_in/be_within.rb +8 -2
- data/lib/rspec/matchers/built_in/change.rb +39 -1
- data/lib/rspec/matchers/built_in/has.rb +40 -7
- data/lib/rspec/matchers/built_in/have.rb +151 -2
- data/lib/rspec/matchers/built_in/include.rb +1 -1
- data/lib/rspec/matchers/built_in/match_array.rb +1 -1
- data/lib/rspec/matchers/built_in/raise_error.rb +7 -1
- data/lib/rspec/matchers/built_in/respond_to.rb +7 -1
- data/lib/rspec/matchers/built_in/satisfy.rb +7 -1
- data/lib/rspec/matchers/built_in/throw_symbol.rb +10 -2
- data/lib/rspec/matchers/built_in/yield.rb +25 -3
- data/lib/rspec/matchers/built_in.rb +2 -2
- data/lib/rspec/matchers/differentiate_block_method_types.rb +55 -0
- data/lib/rspec/matchers/dsl.rb +2 -1
- data/lib/rspec/matchers/match_aliases.rb +22 -0
- data/lib/rspec/matchers/matcher.rb +131 -10
- data/lib/rspec/matchers/operator_matcher.rb +70 -70
- data/lib/rspec/matchers/pretty.rb +4 -0
- data/lib/rspec/matchers/test_unit_integration.rb +22 -5
- data/lib/rspec/matchers.rb +41 -7
- data/lib/rspec-expectations.rb +5 -0
- data/spec/rspec/{matchers → expectations}/configuration_spec.rb +21 -2
- data/spec/rspec/expectations/expectation_target_spec.rb +62 -0
- data/spec/rspec/expectations/extensions/kernel_spec.rb +4 -0
- data/spec/rspec/expectations/handler_spec.rb +1 -1
- data/spec/rspec/expectations/syntax_spec.rb +6 -6
- data/spec/rspec/expectations_spec.rb +22 -1
- data/spec/rspec/matchers/base_matcher_spec.rb +15 -21
- data/spec/rspec/matchers/be_close_spec.rb +4 -1
- data/spec/rspec/matchers/be_spec.rb +105 -10
- data/spec/rspec/matchers/change_spec.rb +76 -1
- data/spec/rspec/matchers/description_generation_spec.rb +22 -18
- data/spec/rspec/matchers/differentiate_block_method_types_spec.rb +39 -0
- data/spec/rspec/matchers/eq_spec.rb +1 -1
- data/spec/rspec/matchers/has_spec.rb +24 -0
- data/spec/rspec/matchers/have_spec.rb +399 -1
- data/spec/rspec/matchers/matcher_spec.rb +213 -24
- data/spec/rspec/matchers/operator_matcher_spec.rb +28 -9
- data/spec/rspec/matchers/pretty_spec.rb +23 -0
- data/spec/rspec/matchers/raise_error_spec.rb +3 -3
- data/spec/rspec/matchers/throw_symbol_spec.rb +14 -14
- data/spec/spec_helper.rb +4 -2
- data/spec/support/helper_methods.rb +42 -0
- data/spec/support/shared_examples.rb +42 -0
- metadata +85 -64
- data/spec/rspec/matchers/matchers_spec.rb +0 -37
|
@@ -1,13 +1,55 @@
|
|
|
1
1
|
shared_examples_for "an RSpec matcher" do |options|
|
|
2
2
|
let(:valid_value) { options.fetch(:valid_value) }
|
|
3
3
|
let(:invalid_value) { options.fetch(:invalid_value) }
|
|
4
|
+
let(:deprecations) { [] }
|
|
5
|
+
|
|
6
|
+
def matched_deprecations
|
|
7
|
+
deprecations.select { |opts| opts[:deprecated] =~ /matcher == value/ }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
allow(RSpec.configuration.reporter).to receive(:deprecation) do |opts|
|
|
12
|
+
deprecations << opts
|
|
13
|
+
end
|
|
14
|
+
end
|
|
4
15
|
|
|
5
16
|
it 'matches a valid value when using #== so it can be composed' do
|
|
6
17
|
expect(matcher).to eq(valid_value)
|
|
7
18
|
end
|
|
8
19
|
|
|
20
|
+
it 'matches a valid value when using #=== so it can be composed' do
|
|
21
|
+
expect(matcher).to be === valid_value
|
|
22
|
+
end
|
|
23
|
+
|
|
9
24
|
it 'does not match an invalid value when using #== so it can be composed' do
|
|
10
25
|
expect(matcher).not_to eq(invalid_value)
|
|
11
26
|
end
|
|
27
|
+
|
|
28
|
+
it 'does not match an invalid value when using #=== so it can be composed' do
|
|
29
|
+
expect(matcher).not_to be === invalid_value
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'does not print a deprecation warning when using #===' do
|
|
33
|
+
matcher === valid_value
|
|
34
|
+
matcher === invalid_value
|
|
35
|
+
expect(matched_deprecations).to eq([])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'does not print a deprecation warning when using #== if it returns false' do
|
|
39
|
+
(matcher == invalid_value).nil? # calling a method to avoid a warning
|
|
40
|
+
expect(matched_deprecations).to eq([])
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'does not print a deprecation warning when using #== if it returns true because it was given the same object' do
|
|
44
|
+
expect(matcher).to be == matcher
|
|
45
|
+
expect(matched_deprecations).to eq([])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'prints a deprecation warning for #== when given a valid value since' do
|
|
49
|
+
(matcher == valid_value).nil? # calling a method to avoid a warning
|
|
50
|
+
expect(matched_deprecations.count).to eq(1)
|
|
51
|
+
deprecation = matched_deprecations.first
|
|
52
|
+
expect(deprecation[:call_site]).to include([__FILE__, __LINE__ - 3].join(':'))
|
|
53
|
+
end
|
|
12
54
|
end
|
|
13
55
|
|
metadata
CHANGED
|
@@ -1,71 +1,88 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-expectations
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 2.99.0
|
|
5
5
|
platform: ruby
|
|
6
|
-
authors:
|
|
6
|
+
authors:
|
|
7
7
|
- Steven Baker
|
|
8
8
|
- David Chelimsky
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
requirements:
|
|
18
|
-
- -
|
|
19
|
-
- !ruby/object:Gem::Version
|
|
12
|
+
date: 2014-06-01 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: diff-lcs
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - ! '>='
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
20
|
version: 1.1.3
|
|
21
21
|
- - <
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version:
|
|
24
|
-
prerelease: false
|
|
25
|
-
name: diff-lcs
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: '2.0'
|
|
26
24
|
type: :runtime
|
|
27
|
-
requirement: *id001
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ~>
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 10.0.0
|
|
34
25
|
prerelease: false
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - ! '>='
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: 1.1.3
|
|
31
|
+
- - <
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.0'
|
|
34
|
+
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: rake
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- !ruby/object:Gem::Dependency
|
|
39
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
41
38
|
- - ~>
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version:
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 10.0.0
|
|
41
|
+
type: :development
|
|
44
42
|
prerelease: false
|
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 10.0.0
|
|
48
|
+
- !ruby/object:Gem::Dependency
|
|
45
49
|
name: cucumber
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- !ruby/object:Gem::Dependency
|
|
49
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
51
52
|
- - ~>
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.1.9
|
|
55
|
+
type: :development
|
|
54
56
|
prerelease: false
|
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ~>
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.1.9
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
55
63
|
name: aruba
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ~>
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.5'
|
|
56
69
|
type: :development
|
|
57
|
-
|
|
70
|
+
prerelease: false
|
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ~>
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0.5'
|
|
58
76
|
description: rspec expectations (should[_not] and matchers)
|
|
59
77
|
email: rspec-users@rubyforge.org
|
|
60
78
|
executables: []
|
|
61
|
-
|
|
62
79
|
extensions: []
|
|
63
|
-
|
|
64
80
|
extra_rdoc_files: []
|
|
65
|
-
|
|
66
|
-
files:
|
|
81
|
+
files:
|
|
67
82
|
- lib/rspec-expectations.rb
|
|
68
83
|
- lib/rspec/expectations.rb
|
|
84
|
+
- lib/rspec/expectations/caller_filter.rb
|
|
85
|
+
- lib/rspec/expectations/configuration.rb
|
|
69
86
|
- lib/rspec/expectations/deprecation.rb
|
|
70
87
|
- lib/rspec/expectations/differ.rb
|
|
71
88
|
- lib/rspec/expectations/errors.rb
|
|
@@ -103,10 +120,11 @@ files:
|
|
|
103
120
|
- lib/rspec/matchers/built_in/throw_symbol.rb
|
|
104
121
|
- lib/rspec/matchers/built_in/yield.rb
|
|
105
122
|
- lib/rspec/matchers/compatibility.rb
|
|
106
|
-
- lib/rspec/matchers/
|
|
123
|
+
- lib/rspec/matchers/differentiate_block_method_types.rb
|
|
107
124
|
- lib/rspec/matchers/dsl.rb
|
|
108
125
|
- lib/rspec/matchers/extensions/instance_eval_with_args.rb
|
|
109
126
|
- lib/rspec/matchers/generated_descriptions.rb
|
|
127
|
+
- lib/rspec/matchers/match_aliases.rb
|
|
110
128
|
- lib/rspec/matchers/matcher.rb
|
|
111
129
|
- lib/rspec/matchers/method_missing.rb
|
|
112
130
|
- lib/rspec/matchers/operator_matcher.rb
|
|
@@ -152,6 +170,7 @@ files:
|
|
|
152
170
|
- features/support/rubinius.rb
|
|
153
171
|
- features/syntax_configuration.feature
|
|
154
172
|
- features/test_frameworks/test_unit.feature
|
|
173
|
+
- spec/rspec/expectations/configuration_spec.rb
|
|
155
174
|
- spec/rspec/expectations/differ_spec.rb
|
|
156
175
|
- spec/rspec/expectations/expectation_target_spec.rb
|
|
157
176
|
- spec/rspec/expectations/extensions/kernel_spec.rb
|
|
@@ -166,9 +185,9 @@ files:
|
|
|
166
185
|
- spec/rspec/matchers/be_spec.rb
|
|
167
186
|
- spec/rspec/matchers/be_within_spec.rb
|
|
168
187
|
- spec/rspec/matchers/change_spec.rb
|
|
169
|
-
- spec/rspec/matchers/configuration_spec.rb
|
|
170
188
|
- spec/rspec/matchers/cover_spec.rb
|
|
171
189
|
- spec/rspec/matchers/description_generation_spec.rb
|
|
190
|
+
- spec/rspec/matchers/differentiate_block_method_types_spec.rb
|
|
172
191
|
- spec/rspec/matchers/dsl_spec.rb
|
|
173
192
|
- spec/rspec/matchers/eq_spec.rb
|
|
174
193
|
- spec/rspec/matchers/eql_spec.rb
|
|
@@ -181,9 +200,9 @@ files:
|
|
|
181
200
|
- spec/rspec/matchers/match_array_spec.rb
|
|
182
201
|
- spec/rspec/matchers/match_spec.rb
|
|
183
202
|
- spec/rspec/matchers/matcher_spec.rb
|
|
184
|
-
- spec/rspec/matchers/matchers_spec.rb
|
|
185
203
|
- spec/rspec/matchers/method_missing_spec.rb
|
|
186
204
|
- spec/rspec/matchers/operator_matcher_spec.rb
|
|
205
|
+
- spec/rspec/matchers/pretty_spec.rb
|
|
187
206
|
- spec/rspec/matchers/raise_error_spec.rb
|
|
188
207
|
- spec/rspec/matchers/respond_to_spec.rb
|
|
189
208
|
- spec/rspec/matchers/satisfy_spec.rb
|
|
@@ -192,37 +211,37 @@ files:
|
|
|
192
211
|
- spec/rspec/matchers/yield_spec.rb
|
|
193
212
|
- spec/spec_helper.rb
|
|
194
213
|
- spec/support/classes.rb
|
|
214
|
+
- spec/support/helper_methods.rb
|
|
195
215
|
- spec/support/in_sub_process.rb
|
|
196
216
|
- spec/support/matchers.rb
|
|
197
217
|
- spec/support/ruby_version.rb
|
|
198
218
|
- spec/support/shared_examples.rb
|
|
199
219
|
homepage: http://github.com/rspec/rspec-expectations
|
|
200
|
-
licenses:
|
|
220
|
+
licenses:
|
|
201
221
|
- MIT
|
|
202
222
|
metadata: {}
|
|
203
|
-
|
|
204
223
|
post_install_message:
|
|
205
|
-
rdoc_options:
|
|
224
|
+
rdoc_options:
|
|
206
225
|
- --charset=UTF-8
|
|
207
|
-
require_paths:
|
|
226
|
+
require_paths:
|
|
208
227
|
- lib
|
|
209
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
|
-
requirements:
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
228
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
|
+
requirements:
|
|
230
|
+
- - ! '>='
|
|
231
|
+
- !ruby/object:Gem::Version
|
|
232
|
+
version: '0'
|
|
233
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
|
+
requirements:
|
|
235
|
+
- - ! '>='
|
|
236
|
+
- !ruby/object:Gem::Version
|
|
237
|
+
version: '0'
|
|
218
238
|
requirements: []
|
|
219
|
-
|
|
220
239
|
rubyforge_project: rspec
|
|
221
|
-
rubygems_version: 2.0.
|
|
240
|
+
rubygems_version: 2.0.7
|
|
222
241
|
signing_key:
|
|
223
242
|
specification_version: 4
|
|
224
|
-
summary: rspec-expectations-2.
|
|
225
|
-
test_files:
|
|
243
|
+
summary: rspec-expectations-2.99.0
|
|
244
|
+
test_files:
|
|
226
245
|
- features/README.md
|
|
227
246
|
- features/Upgrade.md
|
|
228
247
|
- features/built_in_matchers/README.md
|
|
@@ -258,6 +277,7 @@ test_files:
|
|
|
258
277
|
- features/support/rubinius.rb
|
|
259
278
|
- features/syntax_configuration.feature
|
|
260
279
|
- features/test_frameworks/test_unit.feature
|
|
280
|
+
- spec/rspec/expectations/configuration_spec.rb
|
|
261
281
|
- spec/rspec/expectations/differ_spec.rb
|
|
262
282
|
- spec/rspec/expectations/expectation_target_spec.rb
|
|
263
283
|
- spec/rspec/expectations/extensions/kernel_spec.rb
|
|
@@ -272,9 +292,9 @@ test_files:
|
|
|
272
292
|
- spec/rspec/matchers/be_spec.rb
|
|
273
293
|
- spec/rspec/matchers/be_within_spec.rb
|
|
274
294
|
- spec/rspec/matchers/change_spec.rb
|
|
275
|
-
- spec/rspec/matchers/configuration_spec.rb
|
|
276
295
|
- spec/rspec/matchers/cover_spec.rb
|
|
277
296
|
- spec/rspec/matchers/description_generation_spec.rb
|
|
297
|
+
- spec/rspec/matchers/differentiate_block_method_types_spec.rb
|
|
278
298
|
- spec/rspec/matchers/dsl_spec.rb
|
|
279
299
|
- spec/rspec/matchers/eq_spec.rb
|
|
280
300
|
- spec/rspec/matchers/eql_spec.rb
|
|
@@ -287,9 +307,9 @@ test_files:
|
|
|
287
307
|
- spec/rspec/matchers/match_array_spec.rb
|
|
288
308
|
- spec/rspec/matchers/match_spec.rb
|
|
289
309
|
- spec/rspec/matchers/matcher_spec.rb
|
|
290
|
-
- spec/rspec/matchers/matchers_spec.rb
|
|
291
310
|
- spec/rspec/matchers/method_missing_spec.rb
|
|
292
311
|
- spec/rspec/matchers/operator_matcher_spec.rb
|
|
312
|
+
- spec/rspec/matchers/pretty_spec.rb
|
|
293
313
|
- spec/rspec/matchers/raise_error_spec.rb
|
|
294
314
|
- spec/rspec/matchers/respond_to_spec.rb
|
|
295
315
|
- spec/rspec/matchers/satisfy_spec.rb
|
|
@@ -298,6 +318,7 @@ test_files:
|
|
|
298
318
|
- spec/rspec/matchers/yield_spec.rb
|
|
299
319
|
- spec/spec_helper.rb
|
|
300
320
|
- spec/support/classes.rb
|
|
321
|
+
- spec/support/helper_methods.rb
|
|
301
322
|
- spec/support/in_sub_process.rb
|
|
302
323
|
- spec/support/matchers.rb
|
|
303
324
|
- spec/support/ruby_version.rb
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module RSpec
|
|
4
|
-
describe Matchers do
|
|
5
|
-
|
|
6
|
-
let(:sample_matchers) do
|
|
7
|
-
[:be,
|
|
8
|
-
:be_close,
|
|
9
|
-
:be_instance_of,
|
|
10
|
-
:be_kind_of]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context "once required" do
|
|
14
|
-
include TestUnitIntegrationSupport
|
|
15
|
-
|
|
16
|
-
it "includes itself in Test::Unit::TestCase" do
|
|
17
|
-
with_test_unit_loaded do
|
|
18
|
-
test_unit_case = Test::Unit::TestCase.allocate
|
|
19
|
-
sample_matchers.each do |sample_matcher|
|
|
20
|
-
expect(test_unit_case).to respond_to(sample_matcher)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "includes itself in MiniTest::Unit::TestCase", :if => defined?(MiniTest) do
|
|
26
|
-
with_test_unit_loaded do
|
|
27
|
-
minitest_case = MiniTest::Unit::TestCase.allocate
|
|
28
|
-
sample_matchers.each do |sample_matcher|
|
|
29
|
-
expect(minitest_case).to respond_to(sample_matcher)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
end
|