flexmock 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d0a8810418e4e6400b70c2704122d81e4a386f631f9013157429963b386fffa
4
- data.tar.gz: ee80bbf1bcd0d626efa8d7a5512cfc7343c120d7123e83c16e10a35aad4f73c6
3
+ metadata.gz: bed75deb751a06729f5fd1b31ce17b9568fc959cb74b49d6f1291c0de1a53cb7
4
+ data.tar.gz: c7c34401a7d5166ce476b36ca94ceba4789b4c77437f71c2e8f1d00afe3803df
5
5
  SHA512:
6
- metadata.gz: d18374afda345a829ff9264901224891d8fcff4127415e9de3430209f8228cd43285ed79e70dae68b78f35c8affbace80d49767b68a490f67a655cd011bc8518
7
- data.tar.gz: 2b49462130ee807ad062f382b1de1a9e3d25138efd41e2436ffbbaa9190581579f4c503e2eeadd86ec51e38887c7098558996814fc12d0f56f435d54e6266d8a
6
+ metadata.gz: c638316ab0058cea04174eaecc228352bc7710935d57d230362908ed86854fcb53e9aa0236d1003a0d0ebaeeecaa34a7735db20a15e40862242f7aecbcde88b2
7
+ data.tar.gz: c9cd6ea00208e8a7cb0e9d3855886fd2776e8f0d7b60a2fb4a3521ab1051db3d37ea435c44b538215618498197276e83158e05a7b6ea36e29df66c9cac265a5c
data/flexmock.gemspec CHANGED
@@ -10,7 +10,7 @@ spec = Gem::Specification.new do |s|
10
10
  interface is simple, it is very flexible.
11
11
  }
12
12
 
13
- s.required_ruby_version = ">= 2.5"
13
+ s.required_ruby_version = ">= 2.2"
14
14
 
15
15
  s.license = 'MIT'
16
16
 
data/lib/flexmock/core.rb CHANGED
@@ -207,7 +207,7 @@ class FlexMock
207
207
 
208
208
  # Invocke the original non-mocked functionality for the given
209
209
  # symbol.
210
- def flexmock_invoke_original(method_name, args)
210
+ def flexmock_invoke_original(method_name, args, orig_block)
211
211
  return FlexMock.undefined
212
212
  end
213
213
 
@@ -405,9 +405,9 @@ class FlexMock
405
405
 
406
406
  def pass_thru(&block)
407
407
  block ||= lambda { |value| value }
408
- and_return { |*args|
408
+ and_return { |*args, &orig_block|
409
409
  begin
410
- block.call(@mock.flexmock_invoke_original(@sym, args))
410
+ block.call(@mock.flexmock_invoke_original(@sym, args, orig_block))
411
411
  rescue NoMethodError => e
412
412
  if e.name == @sym
413
413
  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, &block)
165
- if block
166
- args << block
167
- end
168
- flexmock_invoke_original(m, args)
165
+ flexmock_invoke_original(m, args, block)
169
166
  end
170
167
 
171
168
  # Whether the given method's original definition has been stored
@@ -321,7 +318,7 @@ class FlexMock
321
318
  # (3) Apply any recorded expecations
322
319
  #
323
320
  def create_new_mocked_object(allocate_method, args, recorder, block)
324
- new_obj = flexmock_invoke_original(allocate_method, args)
321
+ new_obj = flexmock_invoke_original(allocate_method, args, nil)
325
322
  mock = flexmock_container.flexmock(new_obj)
326
323
  block.call(mock) unless block.nil?
327
324
  recorder.apply(mock)
@@ -331,12 +328,8 @@ class FlexMock
331
328
 
332
329
  # Invoke the original definition of method on the object supported by
333
330
  # the stub.
334
- def flexmock_invoke_original(method, args)
331
+ def flexmock_invoke_original(method, args, block)
335
332
  if (original_method = find_original_method(method))
336
- if Proc === args.last
337
- block = args.last
338
- args = args[0..-2]
339
- end
340
333
  original_method.call(*args, &block)
341
334
  else
342
335
  @obj.__send__(:method_missing, method, *args, &block)
@@ -1,3 +1,3 @@
1
1
  class FlexMock
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.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: 2.4.0
4
+ version: 2.4.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
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: '2.5'
168
+ version: '2.2'
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="