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 +4 -4
- data/flexmock.gemspec +1 -1
- data/lib/flexmock/core.rb +1 -1
- data/lib/flexmock/expectation.rb +2 -2
- data/lib/flexmock/partial_mock.rb +3 -10
- data/lib/flexmock/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: bed75deb751a06729f5fd1b31ce17b9568fc959cb74b49d6f1291c0de1a53cb7
|
4
|
+
data.tar.gz: c7c34401a7d5166ce476b36ca94ceba4789b4c77437f71c2e8f1d00afe3803df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c638316ab0058cea04174eaecc228352bc7710935d57d230362908ed86854fcb53e9aa0236d1003a0d0ebaeeecaa34a7735db20a15e40862242f7aecbcde88b2
|
7
|
+
data.tar.gz: c9cd6ea00208e8a7cb0e9d3855886fd2776e8f0d7b60a2fb4a3521ab1051db3d37ea435c44b538215618498197276e83158e05a7b6ea36e29df66c9cac265a5c
|
data/flexmock.gemspec
CHANGED
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
|
|
data/lib/flexmock/expectation.rb
CHANGED
@@ -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
|
-
|
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)
|
data/lib/flexmock/version.rb
CHANGED
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.
|
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-
|
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.
|
168
|
+
version: '2.2'
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|