rspec-mocks 3.7.0 → 3.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f8fec0ae9f2fb0cfdc2ea8486e52a4567c33df9
4
- data.tar.gz: 386582896ee1a855780485f3df9e9331a3a76446
3
+ metadata.gz: 20312b11c0d1afe102fb10eece7ff42580873332
4
+ data.tar.gz: '09febe88bdf3e5548b4aa472cc86163597a51049'
5
5
  SHA512:
6
- metadata.gz: aeac6c1f78a6da17aa0a7fc93b05c6812ba721eb2e51a9bae9b95c7ebdcb626fe1e4bb54cb80755514db5cee2e73c3d2de606456d9f80e1143f4c99c881260ff
7
- data.tar.gz: 5df3cf35c18e6c9b0cccf941102593761feb59ef8b1d83a8508d4c8abfa64ce7bd73a8661959a35502bbe9f981692980a66292624e5ec8355421e5c80b086a11
6
+ metadata.gz: 25e25343ed7f1ecf2a913298c0ef36146bc6934a0d3b73eaccdc4e0645f369ec7e61dd59f811cb6bff4499d94682862e1d8ad8d56ea88f94dfa63b57dded7907
7
+ data.tar.gz: 94cd883965c37989c5b0542c36e955cbb6fbd4ba94b7513326aaa14679966a5bb96449b6e7bc0deda51a77e13411fc9ee33c10c9bc25f73d2bed61770463c4c8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,15 @@
1
- ### 3.8 Development
2
- [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.7.0...master)
1
+ ### 3.8.0 / 2018-08-04
2
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.7.0...v3.8.0)
3
+
4
+ Bug Fixes:
5
+
6
+ * Issue error when encountering invalid "counted" negative message expectations.
7
+ (Sergiy Yarinovskiy, #1212)
8
+ * Ensure `allow_any_instance_of` and `expect_any_instance_of` can be temporarily
9
+ supressed. (Jon Rowe, #1228)
10
+ * Ensure `expect_any_instance_of(double).to_not have_received(:some_method)`
11
+ fails gracefully (as its not supported) rather than issuing a `NoMethodError`.
12
+ (Maxim Krizhanovsky, #1231)
3
13
 
4
14
  ### 3.7.0 / 2017-10-17
5
15
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.6.0...v3.7.0)
@@ -896,7 +906,8 @@ Bug fixes
896
906
  * Fix `should_receive` so that when it is called on an `as_null_object`
897
907
  double with no implementation, and there is a previous explicit stub
898
908
  for the same method, the explicit stub remains (rather than being
899
- overriden with the null object implementation--`return self`). (Myron Marston)
909
+ overridden with the null object implementation--`return self`). (Myron
910
+ Marston)
900
911
 
901
912
  ### 2.11.0 / 2012-07-07
902
913
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.1...v2.11.0)
data/README.md CHANGED
@@ -13,7 +13,7 @@ RSpec repos as well. Add the following to your `Gemfile`:
13
13
 
14
14
  ```ruby
15
15
  %w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
16
- gem lib, :git => "git://github.com/rspec/#{lib}.git", :branch => 'master'
16
+ gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'master'
17
17
  end
18
18
  ```
19
19
  ## Contributing
@@ -242,7 +242,7 @@ module RSpec
242
242
  def observe!(method_name)
243
243
  allow_no_prepended_module_definition_of(method_name)
244
244
 
245
- if RSpec::Mocks.configuration.verify_partial_doubles?
245
+ if RSpec::Mocks.configuration.verify_partial_doubles? && !Mocks.configuration.temporarily_suppress_partial_double_verification
246
246
  unless public_protected_or_private_method_defined?(method_name)
247
247
  AnyInstance.error_generator.raise_does_not_implement_error(@klass, method_name)
248
248
  end
@@ -25,7 +25,7 @@ module RSpec
25
25
  stub
26
26
  end
27
27
 
28
- InovcationOrder =
28
+ InvocationOrder =
29
29
  {
30
30
  :and_return => [:with, nil],
31
31
  :and_raise => [:with, nil],
@@ -38,7 +38,7 @@ module RSpec
38
38
  EmptyInvocationOrder = {}.freeze
39
39
 
40
40
  def invocation_order
41
- InovcationOrder
41
+ InvocationOrder
42
42
  end
43
43
 
44
44
  def verify_invocation_order(rspec_method_name, *_args, &_block)
@@ -72,7 +72,7 @@ module RSpec
72
72
  "#{intro} received #{expectation.message.inspect} #{unexpected_arguments_message(expected_args, actual_args)}".dup
73
73
  end
74
74
 
75
- # rubocop:disable Style/ParameterLists
75
+ # rubocop:disable Metrics/ParameterLists
76
76
  # @private
77
77
  def raise_expectation_error(message, expected_received_count, argument_list_matcher,
78
78
  actual_received_count, expectation_count_type, args,
@@ -81,7 +81,7 @@ module RSpec
81
81
  received_part = received_part_of_expectation_error(actual_received_count, args)
82
82
  __raise "(#{intro(:unwrapped)}).#{message}#{format_args(args)}\n #{expected_part}\n #{received_part}", backtrace_line, source_id
83
83
  end
84
- # rubocop:enable Style/ParameterLists
84
+ # rubocop:enable Metrics/ParameterLists
85
85
 
86
86
  # @private
87
87
  def raise_unimplemented_error(doubled_module, method_name, object)
@@ -76,6 +76,10 @@ module RSpec
76
76
  disallow("expect_any_instance_of")
77
77
  end
78
78
 
79
+ def setup_any_instance_negative_expectation(_subject, &_block)
80
+ disallow("expect_any_instance_of")
81
+ end
82
+
79
83
  private
80
84
 
81
85
  def disallow(type, reason="")
@@ -367,7 +367,7 @@ module RSpec
367
367
  # @private
368
368
  attr_reader :type
369
369
 
370
- # rubocop:disable Style/ParameterLists
370
+ # rubocop:disable Metrics/ParameterLists
371
371
  def initialize(error_generator, expectation_ordering, expected_from, method_double,
372
372
  type=:expectation, opts={}, &implementation_block)
373
373
  @type = type
@@ -395,7 +395,7 @@ module RSpec
395
395
  @implementation = Implementation.new
396
396
  self.inner_implementation_action = implementation_block
397
397
  end
398
- # rubocop:enable Style/ParameterLists
398
+ # rubocop:enable Metrics/ParameterLists
399
399
 
400
400
  def expected_args
401
401
  @argument_list_matcher.expected_args
@@ -581,6 +581,7 @@ module RSpec
581
581
  end
582
582
 
583
583
  def set_expected_received_count(relativity, n)
584
+ raise "`count` is not supported with negative message expectations" if negative?
584
585
  @at_least = (relativity == :at_least)
585
586
  @at_most = (relativity == :at_most)
586
587
  @exactly = (relativity == :exactly)
@@ -650,7 +651,7 @@ module RSpec
650
651
  @error_generator.raise_wrong_arity_error(args, block_signature)
651
652
  end
652
653
 
653
- value = @eval_context ? @eval_context.instance_exec(*args, &block) : block.call(*args)
654
+ value = @eval_context ? @eval_context.instance_exec(*args, &block) : yield(*args)
654
655
  end
655
656
  value
656
657
  end
@@ -64,14 +64,6 @@ module RSpec
64
64
  :public
65
65
  end
66
66
 
67
- private
68
-
69
- def original_method
70
- @object_reference.when_loaded do |m|
71
- self.defined? && find_method(m)
72
- end
73
- end
74
-
75
67
  def self.instance_method_visibility_for(klass, method_name)
76
68
  if klass.public_method_defined?(method_name)
77
69
  :public
@@ -107,6 +99,14 @@ module RSpec
107
99
 
108
100
  return :public if visible
109
101
  end
102
+
103
+ private
104
+
105
+ def original_method
106
+ @object_reference.when_loaded do |m|
107
+ self.defined? && find_method(m)
108
+ end
109
+ end
110
110
  end
111
111
 
112
112
  # @private
@@ -2,6 +2,7 @@ module RSpec
2
2
  module Mocks
3
3
  # @private
4
4
  class Proxy
5
+ # @private
5
6
  SpecificMessage = Struct.new(:object, :message, :args) do
6
7
  def ==(expectation)
7
8
  expectation.orig_object == object && expectation.matches?(message, *args)
@@ -44,7 +44,7 @@ module RSpec
44
44
 
45
45
  # @private
46
46
  def to_s
47
- inspect.gsub('<', '[').gsub('>', ']')
47
+ inspect.tr('<', '[').tr('>', ']')
48
48
  end
49
49
 
50
50
  # @private
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec mocks.
4
4
  module Version
5
5
  # Version of RSpec mocks currently in use in SemVer format.
6
- STRING = '3.7.0'
6
+ STRING = '3.8.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
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: 2017-10-17 00:00:00.000000000 Z
48
+ date: 2018-08-04 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
@@ -53,14 +53,14 @@ dependencies:
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 3.7.0
56
+ version: 3.8.0
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.7.0
63
+ version: 3.8.0
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: diff-lcs
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -210,9 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.6.14
213
+ rubygems_version: 2.6.13
214
214
  signing_key:
215
215
  specification_version: 4
216
- summary: rspec-mocks-3.7.0
216
+ summary: rspec-mocks-3.8.0
217
217
  test_files: []
218
- has_rdoc:
metadata.gz.sig CHANGED
Binary file