lawyer 0.0.11 → 0.0.12

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
  SHA1:
3
- metadata.gz: 3bf51608a99817f5cdb42853a4077ed02a6d205c
4
- data.tar.gz: 9214308046e32041c8c2cda1897bdf5deb422113
3
+ metadata.gz: df0fdd310c4bf5cb45f1718ba8a0b4297ba2036b
4
+ data.tar.gz: 3c60d43bce9b913b577d3bdde6bc7725f20f009c
5
5
  SHA512:
6
- metadata.gz: bfd1c4ce9533de62d8accba3897bfc727cc45f9cbed7fa6f9da0076848a24e96b68b323365655aeb7c019bd39696b19d1f85301b857551d65aecd4aae8cf314d
7
- data.tar.gz: e45a589549eca03ee38e59fab093694a950b90f6bf85ba3d34cce4718fd780cfd33ff6ae54e5d31e54c984cc062c96a3f99f5d75274d58dd691c5df08480afa5
6
+ metadata.gz: a7333a513b566948e3203bac0b2db55ce126bf14e2fdbeb140693b0cbd1b17fde246c32520c5f4db5a452467de972f69c940f87cfa361ee054633731023fdea6
7
+ data.tar.gz: 08e6dc4a6e735cb19756f33f81969465a6b821044587b41f03ddeb4749247f92be7fdf5d98f75cdbe0abe5ec8cb800ed44f4b5feeb9857fea5d6aa1ca06dae82
@@ -13,15 +13,12 @@ module Lawyer
13
13
  true
14
14
  end
15
15
 
16
- with = if clause.arity
17
- clause.arity.times.map { anything }
18
- elsif clause.signature
19
- clause.signature.inject({}) { |acc, name| acc[name] = anything; acc }
20
- else
21
- anything
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
@@ -1,3 +1,3 @@
1
1
  module Lawyer
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lawyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Cinnamond