rspice 0.25.1 → 0.25.7

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: 9bcc95dbf27188a64d6fd0a27759e76aeb6bbeb90fb8e2317abefd101733aa3d
4
- data.tar.gz: 275bf8a6be84a919943408235694281eceee6a2b04e55d6921dbd83c8f8dd89a
3
+ metadata.gz: c5c3cb1bcbd22f7a864bbe2a15b6a9f7cd8875a92b97aa3670cde5d3a14637a8
4
+ data.tar.gz: '068228953133c182a795929beadda2004882caa00dcb9e228107c791a10a64bc'
5
5
  SHA512:
6
- metadata.gz: 95c455cd80538f48a760fe74f625e1477d92b443364ca9852bd2bda476286d2b88bf2ca6455cb4f97b11bbb4e95d4642bdf8f1c033ebb19ed1b4640916fabe6b
7
- data.tar.gz: ca5db750e484e9d61a16832e7fadbca56052d1aac00d7c79edd208177b449dbfb10cc82959985f55dd9d4c226d1853c46a9a2936cf40d6e8e4f3872bbf68c173
6
+ metadata.gz: f3ad9b2641791a401d61779a1348e4e229be8c2274ef18a8c53e4b0bf55590e452ccc5be5efa61db1e84c6580984d6aeb3fa73bf7db35b6bdfcfadd1381d98c7
7
+ data.tar.gz: b45cc708ba176e8429a16cfa72c1f031038f0a77d934c3c6616f5ffde3d5806a883c4ad5ff78792ea272ad4783b3023e5c3ba31b129e504e9c8dfd33281a8d76
@@ -34,7 +34,13 @@
34
34
  RSpec.shared_examples_for "a class pass method" do |method|
35
35
  subject do
36
36
  if accepts_block?
37
- call_class.public_send(method, *arguments, &block)
37
+ if options.present?
38
+ call_class.public_send(method, *arguments, **options, &block)
39
+ else
40
+ call_class.public_send(method, *arguments, &block)
41
+ end
42
+ elsif options.present?
43
+ call_class.public_send(method, *arguments, **options)
38
44
  else
39
45
  call_class.public_send(method, *arguments)
40
46
  end
@@ -47,13 +53,11 @@ RSpec.shared_examples_for "a class pass method" do |method|
47
53
  let(:argument_arity) { method_parameters.map(&:first).select { |type| type.in?(%i[req opt]) }.length }
48
54
  let(:option_keys) { method_parameters.select { |param| param.first.in?(%i[key keyreq]) }.map(&:last) }
49
55
  let(:accepts_block?) { method_parameters.any? { |param| param.first == :block } }
56
+ let(:keyrest?) { method_parameters.any? { |param| param.first == :keyrest } }
50
57
 
51
- let(:arguments) do
52
- Array.new(argument_arity) { double }.tap do |array|
53
- array << options if options.present?
54
- end
55
- end
56
- let(:options) { option_keys.each_with_object({}) { |key, hash| hash[key] = Faker::Lorem.word } }
58
+ let(:arguments) { Array.new(argument_arity) { double } }
59
+ let(:keyrest_keys) { keyrest? ? Faker::Lorem.unique.words.map(&:to_sym) : [] }
60
+ let(:options) { (option_keys + keyrest_keys).each_with_object({}) { |key, hash| hash[key] = Faker::Lorem.word } }
57
61
  let(:block) { -> {} }
58
62
  let(:instance) { instance_double(test_class) }
59
63
  let(:output) { double }
@@ -61,10 +65,26 @@ RSpec.shared_examples_for "a class pass method" do |method|
61
65
  before do
62
66
  allow(instance).to receive(method).and_return(output)
63
67
 
64
- if accepts_block?
65
- allow(test_class).to receive(:new).with(*arguments, &block).and_return(instance)
66
- elsif arguments.any?
67
- allow(test_class).to receive(:new).with(*arguments).and_return(instance)
68
+ if arguments.present?
69
+ if options.present?
70
+ if accepts_block?
71
+ allow(test_class).to receive(:new).with(*arguments, **options, &block).and_return(instance)
72
+ else
73
+ allow(test_class).to receive(:new).with(*arguments, **options).and_return(instance)
74
+ end
75
+ elsif accepts_block?
76
+ allow(test_class).to receive(:new).with(*arguments, &block).and_return(instance)
77
+ else
78
+ allow(test_class).to receive(:new).with(*arguments).and_return(instance)
79
+ end
80
+ elsif options.present?
81
+ if accepts_block?
82
+ allow(test_class).to receive(:new).with(**options, &block).and_return(instance)
83
+ else
84
+ allow(test_class).to receive(:new).with(**options).and_return(instance)
85
+ end
86
+ elsif accepts_block?
87
+ allow(test_class).to receive(:new).with(&block).and_return(instance)
68
88
  else
69
89
  allow(test_class).to receive(:new).with(no_args).and_return(instance)
70
90
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Rspice
4
4
  # This constant is managed by spicerack
5
- VERSION = "0.25.1"
5
+ VERSION = "0.25.7"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.1
4
+ version: 0.25.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-10-13 00:00:00.000000000 Z
14
+ date: 2021-04-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -92,7 +92,7 @@ metadata:
92
92
  homepage_uri: https://github.com/Freshly/spicerack/tree/master/rspice
93
93
  source_code_uri: https://github.com/Freshly/spicerack/tree/master/rspice
94
94
  changelog_uri: https://github.com/Freshly/spicerack/blob/master/rspice/CHANGELOG.md
95
- documentation_uri: https://www.rubydoc.info/gems/rspice/0.25.1
95
+ documentation_uri: https://www.rubydoc.info/gems/rspice/0.25.7
96
96
  post_install_message:
97
97
  rdoc_options: []
98
98
  require_paths: