rspec-expectations 3.8.2 → 3.8.3

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: 6894036d2c3468b781a1a264a637930e11a60362003dd6ecaf05905bb9d3ed44
4
- data.tar.gz: 43fce45f3193b59a1559b08125a602d5ad12089e5fdd321b5dbc3d149f88b7cc
3
+ metadata.gz: 35a04d20c51a45fbf58b5bf8ccdcd5d86f4e2c106aee9906afd3d3bb8e417b62
4
+ data.tar.gz: 3c8218a13a68549fc5df77a74584d87fa71d954058f61bd1710bc8aeeddc2bfd
5
5
  SHA512:
6
- metadata.gz: a50144ac2b3dd7e620766173e25ffe5ff6bcd5f8b71c65eacfb3d4c975eb6c2a80c47be786e3727b316b53883a3e4c47db4a0adff8cc20befeb0d0ecb98fe941
7
- data.tar.gz: a964fb2ed34b703b6cb2f17efe3153c1422a45202376f4cdd5b2e3bd4847065de186464684c3aaf9d83a746eede227be226e3de5b0c5267f11b791d3499efaf2
6
+ metadata.gz: f196ef51fc2f48e4d5dd5a685b0847f797c5ef8e0de9b294873dbcadbcb2f2fb1574ef1662052f2e127083195a149ae604a95f5725cd879f912d586be2b37d8f
7
+ data.tar.gz: 93a6786e1205e5baddad562b0162de3452b9659a73f7a566e40a1c7c7b93d60637b64db27a366056b93a1a6187436feddd3a0eb80507ed69a37b8a6747bc23e2
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,19 @@
1
+ ### Development
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.3...3-8-maintenance)
3
+
4
+ ### 3.8.3 / 2019-04-20
5
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.2...v3.8.3)
6
+
7
+ Bug Fixes:
8
+
9
+ * Prevent composed `all` matchers from leaking into their siblings leading to duplicate
10
+ failures. (Jamie English, #1086)
11
+ * Prevent objects which change their hash on comparison from failing change checks.
12
+ (Phil Pirozhkov, #1110)
13
+ * Issue an `ArgumentError` rather than a `NoMethodError` when `be_an_instance_of` and
14
+ `be_kind_of` matchers encounter objects not supporting those methods.
15
+ (Taichi Ishitani, #1107)
16
+
1
17
  ### 3.8.2 / 2018-10-09
2
18
  [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.1...v3.8.2)
3
19
 
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '3.8.2'
5
+ STRING = '3.8.3'
6
6
  end
7
7
  end
8
8
  end
@@ -73,6 +73,7 @@ module RSpec
73
73
 
74
74
  def initialize_copy(other)
75
75
  @matcher = @matcher.clone
76
+ @failed_objects = @failed_objects.clone
76
77
  super
77
78
  end
78
79
 
@@ -14,7 +14,17 @@ module RSpec
14
14
  private
15
15
 
16
16
  def match(expected, actual)
17
- actual.instance_of? expected
17
+ if actual_object_respond_to?(actual, :instance_of?)
18
+ actual.instance_of?(expected)
19
+ else
20
+ raise ::ArgumentError, "The #{matcher_name} matcher requires that " \
21
+ "the actual object responds to #instance_of? method " \
22
+ "but it does not respond to the method."
23
+ end
24
+ end
25
+
26
+ def actual_object_respond_to?(actual, method)
27
+ ::Kernel.instance_method(:respond_to?).bind(actual).call(method)
18
28
  end
19
29
  end
20
30
  end
@@ -8,7 +8,19 @@ module RSpec
8
8
  private
9
9
 
10
10
  def match(expected, actual)
11
- actual.kind_of? expected
11
+ if actual_object_respond_to?(actual, :kind_of?)
12
+ actual.kind_of?(expected)
13
+ elsif actual_object_respond_to?(actual, :is_a?)
14
+ actual.is_a?(expected)
15
+ else
16
+ raise ::ArgumentError, "The #{matcher_name} matcher requires that " \
17
+ "the actual object responds to either #kind_of? or #is_a? methods "\
18
+ "but it responds to neigher of two methods."
19
+ end
20
+ end
21
+
22
+ def actual_object_respond_to?(actual, method)
23
+ ::Kernel.instance_method(:respond_to?).bind(actual).call(method)
12
24
  end
13
25
  end
14
26
  end
@@ -373,6 +373,7 @@ module RSpec
373
373
  event_proc.call
374
374
 
375
375
  @actual_after = evaluate_value_proc
376
+ @actual_hash = @actual_after.hash
376
377
  true
377
378
  end
378
379
 
@@ -387,8 +388,9 @@ module RSpec
387
388
  #
388
389
  # Note that it is not sufficient to only check the hashes; it is
389
390
  # possible for two values to be unequal (and of different classes)
390
- # but to return the same hash value.
391
- @actual_before != @actual_after || @before_hash != @actual_after.hash
391
+ # but to return the same hash value. Also, some objects may change
392
+ # their hash after being compared with `==`/`!=`.
393
+ @actual_before != @actual_after || @before_hash != @actual_hash
392
394
  end
393
395
 
394
396
  def actual_delta
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.8.2
4
+ version: 3.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -45,7 +45,7 @@ cert_chain:
45
45
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
46
46
  F3MdtaDehhjC
47
47
  -----END CERTIFICATE-----
48
- date: 2018-10-09 00:00:00.000000000 Z
48
+ date: 2019-04-21 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
@@ -200,7 +200,12 @@ files:
200
200
  homepage: https://github.com/rspec/rspec-expectations
201
201
  licenses:
202
202
  - MIT
203
- metadata: {}
203
+ metadata:
204
+ bug_tracker_uri: https://github.com/rspec/rspec-expectations/issues
205
+ changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.8.3/Changelog.md
206
+ documentation_uri: https://rspec.info/documentation/
207
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
208
+ source_code_uri: https://github.com/rspec/rspec-expectations
204
209
  post_install_message:
205
210
  rdoc_options:
206
211
  - "--charset=UTF-8"
@@ -217,9 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
222
  - !ruby/object:Gem::Version
218
223
  version: '0'
219
224
  requirements: []
220
- rubyforge_project:
221
- rubygems_version: 2.7.6
225
+ rubygems_version: 3.0.3
222
226
  signing_key:
223
227
  specification_version: 4
224
- summary: rspec-expectations-3.8.2
228
+ summary: rspec-expectations-3.8.3
225
229
  test_files: []
metadata.gz.sig CHANGED
Binary file