stack_commander 0.0.3 → 0.0.4
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 +4 -4
- data/lib/stack_commander/dependency_injection.rb +5 -1
- data/lib/stack_commander/stack.rb +2 -0
- data/lib/stack_commander/version.rb +1 -1
- data/spec/stack_spec.rb +14 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 193bc58f68f2558b4b761f2c229210af8cfb4ac8
|
4
|
+
data.tar.gz: 93db5d8c010915aae4b2660d52dc23a4d8af2466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f58bdd6428f9f29e5691b7627edb6560e1b4414392b8e930fa032aef7935b7e30640d644469ea3eff2432a405eb4b0068bff5b04930909d6679960da8809a9d
|
7
|
+
data.tar.gz: 0c1fd12293e2e411d3fa183fd6f36cbad7d534086b595803a2f94dc7c1eeb86bebde91b00ebff87b34ec6d0839df594b639cfdd9d8e28ca67959506809d52401
|
@@ -21,8 +21,12 @@ module StackCommander
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def match!(scope)
|
25
25
|
raise InvalidScope, scope unless matches?(scope)
|
26
|
+
end
|
27
|
+
|
28
|
+
def extract(scope)
|
29
|
+
match!(scope)
|
26
30
|
|
27
31
|
required_parameters.map do |param|
|
28
32
|
scope.public_send(param)
|
data/spec/stack_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe StackCommander::Stack do
|
|
12
12
|
|
13
13
|
it 'enqueues commands' do
|
14
14
|
expect(stack.size).to eq(0)
|
15
|
-
stack << double('command')
|
15
|
+
stack << double('command').as_null_object
|
16
16
|
expect(stack.size).to eq(1)
|
17
17
|
end
|
18
18
|
|
@@ -66,4 +66,17 @@ describe StackCommander::Stack do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
context 'command not matching scope' do
|
71
|
+
let(:command) do
|
72
|
+
Class.new(StackCommander::BaseCommand) do
|
73
|
+
def initialize(dependency)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'checks scope when adding command' do
|
79
|
+
expect { stack << command }.to raise_error(StackCommander::DependencyInjection::InvalidScope)
|
80
|
+
end
|
81
|
+
end
|
69
82
|
end
|