lawyer 0.0.11 → 0.0.12
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df0fdd310c4bf5cb45f1718ba8a0b4297ba2036b
|
4
|
+
data.tar.gz: 3c60d43bce9b913b577d3bdde6bc7725f20f009c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7333a513b566948e3203bac0b2db55ce126bf14e2fdbeb140693b0cbd1b17fde246c32520c5f4db5a452467de972f69c940f87cfa361ee054633731023fdea6
|
7
|
+
data.tar.gz: 08e6dc4a6e735cb19756f33f81969465a6b821044587b41f03ddeb4749247f92be7fdf5d98f75cdbe0abe5ec8cb800ed44f4b5feeb9857fea5d6aa1ca06dae82
|
@@ -13,15 +13,12 @@ module Lawyer
|
|
13
13
|
true
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
allow(the_double).to receive(clause.name).with(with).and_return(return_value)
|
16
|
+
receiver = allow(the_double).to receive(clause.name).and_return(return_value)
|
17
|
+
if clause.arity
|
18
|
+
receiver.with(*clause.arity.times.map { anything })
|
19
|
+
elsif clause.signature
|
20
|
+
receiver.with(clause.signature.inject({}) { |acc, name| acc[name] = anything; acc })
|
21
|
+
end
|
25
22
|
end
|
26
23
|
the_double
|
27
24
|
end
|
data/lib/lawyer/version.rb
CHANGED
@@ -17,9 +17,11 @@ describe Lawyer::RSpec::ContractDouble do
|
|
17
17
|
|
18
18
|
it "checks method arity" do
|
19
19
|
expect { the_double.arity(1) }.to raise_error(RSpec::Mocks::MockExpectationError)
|
20
|
+
expect { the_double.arity(1, 2) }.not_to raise_error
|
20
21
|
end
|
21
22
|
|
22
23
|
it "checks named arguments" do
|
23
24
|
expect { the_double.named }.to raise_error(RSpec::Mocks::MockExpectationError)
|
25
|
+
expect { the_double.named(arg: 1, arg2: 2) }.not_to raise_error
|
24
26
|
end
|
25
27
|
end
|