much-stub 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/much-stub/call_spy.rb +2 -4
- data/lib/much-stub/version.rb +1 -1
- data/test/unit/call_spy_tests.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4801d3a180d37bd01d02a52d1c524d38f432e4bb287a87d1e7753825efb180a
|
4
|
+
data.tar.gz: 422762b6602a2f05725fd61561e745bced7430b3e459ee7198a670ce86e922bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eb227fd853591c057e7869a6331cbd36ba0a308eb4a0a3a32313ea779ec740f89e32a297160fb40bd3400222af83693830c260df3c461d79d40e72d45d1df24
|
7
|
+
data.tar.gz: 8b7ab33cb886b60f4242bdaa6a1bcf9a5d1666c2b37a335eb01ab032d59841ff648b5bed5ffded02dfd40f2fe4451e1649ae45488a133c6773ef00670ae760d7
|
data/lib/much-stub/call_spy.rb
CHANGED
@@ -54,10 +54,8 @@ module MuchStub
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def call_spy_return_value_proc(method_name)
|
57
|
-
value = @call_spy_return_values
|
58
|
-
|
59
|
-
|
60
|
-
::Proc.new { value.nil? ? self : value }
|
57
|
+
value = @call_spy_return_values.fetch(method_name, ::Proc.new { self })
|
58
|
+
value.respond_to?(:call) ? value : ::Proc.new { value }
|
61
59
|
end
|
62
60
|
|
63
61
|
def call_spy_normalize_method_name(name)
|
data/lib/much-stub/version.rb
CHANGED
data/test/unit/call_spy_tests.rb
CHANGED
@@ -93,4 +93,16 @@ class MuchStub::CallSpy
|
|
93
93
|
assert_equal @result, subject.get.set!("value1").any?
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
class InitWithNilReturnValuesTests < UnitTests
|
98
|
+
desc "when init with nil return values"
|
99
|
+
setup do
|
100
|
+
@spy = @unit_class.new(result: nil)
|
101
|
+
end
|
102
|
+
subject{ @spy }
|
103
|
+
|
104
|
+
should "return nil" do
|
105
|
+
assert_equal "nil", subject.get.set!("value1").result.inspect
|
106
|
+
end
|
107
|
+
end
|
96
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: much-stub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: assert
|