grift 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +2 -2
- data/README.md +1 -0
- data/lib/grift/mock_method.rb +4 -2
- data/lib/grift/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '06800e91cb7e76be9232c7cf700d99ede4ba25212ed323abd1d5a4e944de455d'
|
4
|
+
data.tar.gz: 2d844fc80a5edcb9eb809c4946d7ee464465e8423b7a42e2f3a4ff4657e791d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a2e6a02bab0921a5c91c48c5fbbf67d1a9dd0b0d50bd3c4d9dfb49d6f686623ca0c017d1d51f1df3220b4c1c83c1fd9a26070daa05c36c38d657a2476a4602
|
7
|
+
data.tar.gz: a7197e5fb4f7bbaf506426c9f4ed2a04733201f8a27a4f015df9af7466c9bd8563e700c2adaaef34211690c5ecf795ded15308701877bd5a0fbb6ed5278b366a
|
data/CHANGELOG.md
CHANGED
@@ -8,8 +8,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
8
8
|
|
9
9
|
None
|
10
10
|
|
11
|
+
## [2.0.1](https://github.com/clarkedb/grift/releases/tag/v2.0.1) - 2022-03-27
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
* When spying on a method that takes a block, the block now gets forwarded to the original method ([#78](https://github.com/clarkedb/grift/pull/78))
|
16
|
+
* When mocking the implementation, if a block is not provided a `Grift::Error` is raised instead of a `LocalJumpError` ([#77](https://github.com/clarkedb/grift/pull/77))
|
17
|
+
|
11
18
|
## [2.0.0](https://github.com/clarkedb/grift/releases/tag/v2.0.0) - 2022-03-14
|
12
19
|
|
20
|
+
This version adds true keyword argument support for Ruby 3. See below for how to handle breaking changes.
|
21
|
+
|
13
22
|
### Changed
|
14
23
|
|
15
24
|
* Dropped support for Ruby 2.5 ([#69](https://github.com/clarkedb/grift/pull/69))
|
@@ -17,7 +26,7 @@ None
|
|
17
26
|
* To support keyword arguments, records of call arguments are no longer stored in simple arrays but in a custom Enumerable ([#72](https://github.com/clarkedb/grift/pull/72))
|
18
27
|
+ This changes the way that your tests will interact with mock calls
|
19
28
|
+ When before `calls` returned an array, it returns a `Grift::MockMethod::MockExecutions::MockArguments` object
|
20
|
-
+ Migrating to maintain previous behavior just requires appending `.args` to `calls`
|
29
|
+
+ Migrating to maintain previous behavior just requires appending `.args` to `calls[i]`
|
21
30
|
|
22
31
|
### Added
|
23
32
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/grift/mock_method.rb
CHANGED
@@ -134,6 +134,8 @@ module Grift
|
|
134
134
|
# @return [self] the mock itself
|
135
135
|
#
|
136
136
|
def mock_implementation(*)
|
137
|
+
raise(Grift::Error, 'Must provide a block for the new implementation') unless block_given?
|
138
|
+
|
137
139
|
premock_setup
|
138
140
|
mock_executions = @mock_executions # required to access inside class instance block
|
139
141
|
|
@@ -220,8 +222,8 @@ module Grift
|
|
220
222
|
cache_method_name = @cache_method_name
|
221
223
|
|
222
224
|
class_instance.remove_method(@method_name) if !@inherited && method_defined?
|
223
|
-
class_instance.define_method @method_name do |*args, **kwargs|
|
224
|
-
return_value = send(cache_method_name, *args, **kwargs)
|
225
|
+
class_instance.define_method @method_name do |*args, **kwargs, &block|
|
226
|
+
return_value = send(cache_method_name, *args, **kwargs, &block)
|
225
227
|
|
226
228
|
# record the args passed in the call to the method and the result
|
227
229
|
mock_executions.store(args: args, kwargs: kwargs, result: return_value)
|
data/lib/grift/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clark Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem for simple mocking and spying in Ruby's MiniTest framework.
|
14
14
|
email:
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.2.32
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Mocking and spying in MiniTest
|