rspec-mocks 3.9.1 → 3.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +34 -0
- data/README.md +5 -5
- data/lib/rspec/mocks.rb +4 -1
- data/lib/rspec/mocks/any_instance/recorder.rb +1 -0
- data/lib/rspec/mocks/message_expectation.rb +2 -2
- data/lib/rspec/mocks/method_double.rb +1 -0
- data/lib/rspec/mocks/mutate_const.rb +1 -1
- data/lib/rspec/mocks/proxy.rb +16 -0
- data/lib/rspec/mocks/version.rb +1 -1
- metadata +12 -12
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8df50d671b287d9eea08c7e0af0cc98ae18da52ce63543c0e48378d4230a889f
|
4
|
+
data.tar.gz: 0e8e4186d4eefc8344439185e0533a53b980fd983f80d8faf600c5fe7f5ebf2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b687302ef0bd48764d9b78df91c0ce9f4918e9697493fbf0d4083f77ac4bd99879a68975bca874b06a887d1f83bcaaca35f476d4a4036286684c37bb3e040c6
|
7
|
+
data.tar.gz: 102e13e93f56865812cf40a46e3be075f67984dde3eaae091b3b14ffae2c96623f6c2e85112c6ffe759fc7be83c4ba8d0133b59fa91d5d0a3055307dc5c13273
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
### Development
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.10.2...main)
|
3
|
+
|
4
|
+
### 3.10.2 / 2021-01-27
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.10.1...v3.10.2)
|
6
|
+
|
7
|
+
Bug Fixes:
|
8
|
+
|
9
|
+
* Support keyword arguments with `and_call_original` on Ruby 3.0.
|
10
|
+
(Bryan Powell, #1385)
|
11
|
+
* `RSpec::Mocks::Constant#previously_defined?` is now always a boolean.
|
12
|
+
(Phil Pirozhkov, #1397)
|
13
|
+
* Support keyword arguments on Ruby 3.0 when used with `expect_any_instance_of`
|
14
|
+
or `allow_any_instance_of` with `and_call_original`.
|
15
|
+
(Jess Hottenstein, #1407)
|
16
|
+
|
17
|
+
### 3.10.1 / 2020-12-27
|
18
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.10.0...v3.10.1)
|
19
|
+
|
20
|
+
Bug Fixes:
|
21
|
+
|
22
|
+
* Issue `ArgumentError` rather than `TypeError` when unsupported methods on
|
23
|
+
unsupported objects are attempted to be stubbed. (@zhisme, #1357)
|
24
|
+
|
25
|
+
### 3.10.0 / 2020-10-30
|
26
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.9.1...v3.10.0)
|
27
|
+
|
28
|
+
Enhancements:
|
29
|
+
* Add the ability to set a custom error generator in `MessageExpectation`.
|
30
|
+
This will allow rspec-expectations to inject a custom failure message.
|
31
|
+
(Benoit Tigeot and Nicolas Zermati, #1312)
|
32
|
+
* Return the result of the block passed to `RSpec::Mocks.with_temporary_scope`
|
33
|
+
when block run. (@expeehaa, #1329)
|
34
|
+
|
1
35
|
### 3.9.1 / 2019-12-31
|
2
36
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.9.0...v3.9.1)
|
3
37
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RSpec Mocks [![Build Status](https://
|
1
|
+
# RSpec Mocks [![Build Status](https://github.com/rspec/rspec-mocks/workflows/RSpec%20CI/badge.svg?branch=3-10-maintenance)](https://github.com/rspec/rspec-mocks/actions) [![Code Climate](https://codeclimate.com/github/rspec/rspec-mocks.svg)](https://codeclimate.com/github/rspec/rspec-mocks)
|
2
2
|
rspec-mocks is a test-double framework for rspec with support for method stubs,
|
3
3
|
fakes, and message expectations on generated test-doubles and real objects
|
4
4
|
alike.
|
@@ -8,12 +8,12 @@ alike.
|
|
8
8
|
gem install rspec # for rspec-core, rspec-expectations, rspec-mocks
|
9
9
|
gem install rspec-mocks # for rspec-mocks only
|
10
10
|
|
11
|
-
Want to run against the `
|
11
|
+
Want to run against the `main` branch? You'll need to include the dependent
|
12
12
|
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 => "https://github.com/rspec/#{lib}.git", :branch => '
|
16
|
+
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
|
17
17
|
end
|
18
18
|
```
|
19
19
|
## Contributing
|
@@ -53,7 +53,7 @@ book = instance_double("Book", :pages => 250)
|
|
53
53
|
Verifying doubles have some clever tricks to enable you to both test in
|
54
54
|
isolation without your dependencies loaded while still being able to validate
|
55
55
|
them against real objects. More detail is available in [their
|
56
|
-
documentation](https://github.com/rspec/rspec-mocks/blob/
|
56
|
+
documentation](https://github.com/rspec/rspec-mocks/blob/main/features/verifying_doubles).
|
57
57
|
|
58
58
|
Verifying doubles can also accept custom identifiers, just like double(), e.g.:
|
59
59
|
|
@@ -403,7 +403,7 @@ your code.
|
|
403
403
|
## Stubbing and Hiding Constants
|
404
404
|
|
405
405
|
See the [mutating constants
|
406
|
-
README](https://github.com/rspec/rspec-mocks/blob/
|
406
|
+
README](https://github.com/rspec/rspec-mocks/blob/main/features/mutating_constants/README.md)
|
407
407
|
for info on this feature.
|
408
408
|
|
409
409
|
## Use `before(:example)`, not `before(:context)`
|
data/lib/rspec/mocks.rb
CHANGED
@@ -87,12 +87,15 @@ module RSpec
|
|
87
87
|
|
88
88
|
# Call the passed block and verify mocks after it has executed. This allows
|
89
89
|
# mock usage in arbitrary places, such as a `before(:all)` hook.
|
90
|
+
#
|
91
|
+
# @return [Object] the return value from the block
|
90
92
|
def self.with_temporary_scope
|
91
93
|
setup
|
92
94
|
|
93
95
|
begin
|
94
|
-
yield
|
96
|
+
result = yield
|
95
97
|
verify
|
98
|
+
result
|
96
99
|
ensure
|
97
100
|
teardown
|
98
101
|
end
|
@@ -366,7 +366,7 @@ module RSpec
|
|
366
366
|
attr_reader :message
|
367
367
|
attr_reader :orig_object
|
368
368
|
attr_writer :expected_received_count, :expected_from, :argument_list_matcher
|
369
|
-
protected :expected_received_count=, :expected_from=, :error_generator
|
369
|
+
protected :expected_received_count=, :expected_from=, :error_generator=, :implementation=
|
370
370
|
|
371
371
|
# @private
|
372
372
|
attr_reader :type
|
@@ -376,7 +376,7 @@ module RSpec
|
|
376
376
|
type=:expectation, opts={}, &implementation_block)
|
377
377
|
@type = type
|
378
378
|
@error_generator = error_generator
|
379
|
-
@error_generator.opts = opts
|
379
|
+
@error_generator.opts = error_generator.opts.merge(opts)
|
380
380
|
@expected_from = expected_from
|
381
381
|
@method_double = method_double
|
382
382
|
@orig_object = @method_double.object
|
data/lib/rspec/mocks/proxy.rb
CHANGED
@@ -21,6 +21,8 @@ module RSpec
|
|
21
21
|
|
22
22
|
# @private
|
23
23
|
def initialize(object, order_group, options={})
|
24
|
+
ensure_can_be_proxied!(object)
|
25
|
+
|
24
26
|
@object = object
|
25
27
|
@order_group = order_group
|
26
28
|
@error_generator = ErrorGenerator.new(object)
|
@@ -31,6 +33,20 @@ module RSpec
|
|
31
33
|
@method_doubles = Hash.new { |h, k| h[k] = MethodDouble.new(@object, k, self) }
|
32
34
|
end
|
33
35
|
|
36
|
+
# @private
|
37
|
+
def ensure_can_be_proxied!(object)
|
38
|
+
return unless object.is_a?(Symbol) || object.frozen?
|
39
|
+
return if object.nil?
|
40
|
+
|
41
|
+
msg = "Cannot proxy frozen objects"
|
42
|
+
if Symbol === object
|
43
|
+
msg << ". Symbols such as #{object} cannot be mocked or stubbed."
|
44
|
+
else
|
45
|
+
msg << ", rspec-mocks relies on proxies for method stubbing and expectations."
|
46
|
+
end
|
47
|
+
raise ArgumentError, msg
|
48
|
+
end
|
49
|
+
|
34
50
|
# @private
|
35
51
|
attr_reader :object
|
36
52
|
|
data/lib/rspec/mocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
8
8
|
- David Chelimsky
|
9
9
|
- Myron Marston
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain:
|
13
13
|
- |
|
@@ -45,7 +45,7 @@ cert_chain:
|
|
45
45
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
46
46
|
F3MdtaDehhjC
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date:
|
48
|
+
date: 2021-01-28 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.
|
56
|
+
version: 3.10.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.
|
63
|
+
version: 3.10.0
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: diff-lcs
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
name: rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">"
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 10.0.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - ">"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 10.0.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
@@ -194,11 +194,11 @@ licenses:
|
|
194
194
|
- MIT
|
195
195
|
metadata:
|
196
196
|
bug_tracker_uri: https://github.com/rspec/rspec-mocks/issues
|
197
|
-
changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.
|
197
|
+
changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.10.2/Changelog.md
|
198
198
|
documentation_uri: https://rspec.info/documentation/
|
199
199
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
200
200
|
source_code_uri: https://github.com/rspec/rspec-mocks
|
201
|
-
post_install_message:
|
201
|
+
post_install_message:
|
202
202
|
rdoc_options:
|
203
203
|
- "--charset=UTF-8"
|
204
204
|
require_paths:
|
@@ -214,8 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
218
|
-
signing_key:
|
217
|
+
rubygems_version: 3.2.4
|
218
|
+
signing_key:
|
219
219
|
specification_version: 4
|
220
|
-
summary: rspec-mocks-3.
|
220
|
+
summary: rspec-mocks-3.10.2
|
221
221
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|