flexmock 3.0.0 → 3.0.1

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: 97fdfec71cb9dd687df62403b26eb8d4d24e4b28ec7f35f5e2d5f3ac6ffed943
4
- data.tar.gz: 8f250a12f731099db17e9fcea78b92e0b92ac523376a34e06b5295f3a17ec996
3
+ metadata.gz: a0f97dabc8c9afa58ef46d4ac17b2e3fa8295f6d20446dc1638291042e41e5d8
4
+ data.tar.gz: 2bd6a9f043efac740a59f4864da6d668809a30d71ffd97c72efc0c246aaca43f
5
5
  SHA512:
6
- metadata.gz: 7672fd90360b33327119a7f135a7db9d05c7b7d41e0dd5299396296e0b68c8bb5175eaa2cf8d334b9b8cc62f52a87af4fe8af8216a4e9283341c909eed5ca196
7
- data.tar.gz: a2112c506ef7152ba13aef9f67cb9ab5d58a0b566b5f50e7db00e545ff04e663da129f8291109dc25f028b2150ca4a936d96ced1444cbb85b4298534179046dc
6
+ metadata.gz: 6f06e6198573d73ee08d793ff8f90147a873403a8427e677afdc7301fc06701975f711ebceb51ac5f32c280a29d1c1411a6265095e8bcfa1c362eedd8194a054
7
+ data.tar.gz: 19325f609dc6e084ce7d0748e0142368d9ca9caf1706733d23287d5001c0f36c9dd25d7194b0a3e5389601628b63aa987a351eb7e6568eb38662a9245cbc8b65
@@ -12,7 +12,6 @@ jobs:
12
12
  - "3.2"
13
13
  - "3.1"
14
14
  - "3.0"
15
- - "2.7"
16
15
 
17
16
  steps:
18
17
  - uses: actions/checkout@v2
data/lib/flexmock/core.rb CHANGED
@@ -206,7 +206,7 @@ class FlexMock
206
206
 
207
207
  # Invocke the original non-mocked functionality for the given
208
208
  # symbol.
209
- def flexmock_invoke_original(method_name, args, kw = {})
209
+ def flexmock_invoke_original(method_name, args, kw = {}, orig_block = nil)
210
210
  return FlexMock.undefined
211
211
  end
212
212
 
@@ -392,9 +392,9 @@ class FlexMock
392
392
 
393
393
  def pass_thru(&block)
394
394
  block ||= lambda { |value| value }
395
- and_return { |*args, **kw|
395
+ and_return { |*args, **kw, &orig_block|
396
396
  begin
397
- block.call(@mock.flexmock_invoke_original(@sym, args, kw))
397
+ block.call(@mock.flexmock_invoke_original(@sym, args, kw, orig_block))
398
398
  rescue NoMethodError => e
399
399
  if e.name == @sym
400
400
  raise e, "#{e.message} while performing #pass_thru in expectation object #{self}"
@@ -162,10 +162,7 @@ class FlexMock
162
162
  #
163
163
  # Usually called in a #and_return statement
164
164
  def invoke_original(m, *args, **kw, &block)
165
- if block
166
- args << block
167
- end
168
- flexmock_invoke_original(m, args, kw)
165
+ flexmock_invoke_original(m, args, kw, block)
169
166
  end
170
167
 
171
168
  # Whether the given method's original definition has been stored
@@ -336,7 +333,7 @@ class FlexMock
336
333
  # (3) Apply any recorded expecations
337
334
  #
338
335
  def create_new_mocked_object(allocate_method, args, kw, recorder, block)
339
- new_obj = flexmock_invoke_original(allocate_method, args, kw)
336
+ new_obj = flexmock_invoke_original(allocate_method, args, kw, nil)
340
337
  mock = flexmock_container.flexmock(new_obj)
341
338
  block.call(mock) unless block.nil?
342
339
  recorder.apply(mock)
@@ -346,12 +343,8 @@ class FlexMock
346
343
 
347
344
  # Invoke the original definition of method on the object supported by
348
345
  # the stub.
349
- def flexmock_invoke_original(method, args, kw)
346
+ def flexmock_invoke_original(method, args, kw, block)
350
347
  if (original_method = find_original_method(method))
351
- if Proc === args.last
352
- block = args.last
353
- args = args[0..-2]
354
- end
355
348
  original_method.call(*args, **kw, &block)
356
349
  else
357
350
  @obj.__send__(:method_missing, method, *args, **kw, &block)
@@ -1,3 +1,3 @@
1
1
  class FlexMock
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-08-20 00:00:00.000000000 Z
12
+ date: 2024-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest