subroutine 0.10.0.beta7 → 0.10.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/subroutine/outputs.rb +15 -4
- data/lib/subroutine/version.rb +1 -1
- data/test/subroutine/base_test.rb +10 -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: 4c5dff0a8ab49afebd76be4189b3128c27f6f79786a4745fb01a9b18b023ea44
|
4
|
+
data.tar.gz: 1329a8feaedde19122bb3afbca4eda13818dcb720b9edc0b01cd58e3422c4463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2acf6bdb0f20e14dbf24155a3e4d80db6715d7eb9ab6869d0ef2b07a7cf7efd2ef9b4287827fcf25d0877c5910e979885e8fa5fe84256d16479bc47340b7cd04
|
7
|
+
data.tar.gz: b0c826a03266eeafd1db07597c0c70c43065b73780137182129310238e0e74c04505d83a207dc1357ba20c5b00cfd1107c3d9d92152213961c7256ec4fb10fee
|
data/lib/subroutine/outputs.rb
CHANGED
@@ -36,15 +36,26 @@ module Subroutine
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def setup_outputs
|
39
|
-
@outputs = {}
|
39
|
+
@outputs = {} # don't do with_indifferent_access because it will turn provided objects into with_indifferent_access objects, which may not be the desired behavior
|
40
|
+
end
|
41
|
+
|
42
|
+
def output_provided?(name)
|
43
|
+
name = name.to_sym
|
44
|
+
|
45
|
+
unless output_configurations.key?(name)
|
46
|
+
raise ::Subroutine::Outputs::UnknownOutputError, name
|
47
|
+
end
|
48
|
+
|
49
|
+
outputs.key?(name)
|
40
50
|
end
|
41
51
|
|
42
52
|
def output(name, value)
|
43
|
-
|
53
|
+
name = name.to_sym
|
54
|
+
unless output_configurations.key?(name)
|
44
55
|
raise ::Subroutine::Outputs::UnknownOutputError, name
|
45
56
|
end
|
46
57
|
|
47
|
-
outputs[name
|
58
|
+
outputs[name] = value
|
48
59
|
end
|
49
60
|
|
50
61
|
def get_output(name)
|
@@ -56,7 +67,7 @@ module Subroutine
|
|
56
67
|
|
57
68
|
def validate_outputs!
|
58
69
|
output_configurations.each_pair do |name, config|
|
59
|
-
if config.required? && !
|
70
|
+
if config.required? && !output_provided?(name)
|
60
71
|
raise ::Subroutine::Outputs::OutputNotSetError, name
|
61
72
|
end
|
62
73
|
end
|
data/lib/subroutine/version.rb
CHANGED
@@ -228,6 +228,16 @@ module Subroutine
|
|
228
228
|
assert_equal "foo@bar.com", u.email_address
|
229
229
|
end
|
230
230
|
|
231
|
+
# Hash#with_indifferent_access was changing output objects
|
232
|
+
def test_outputs_are_not_mutated
|
233
|
+
out = { "foo" => "bar" }
|
234
|
+
op = ::SignupOp.new
|
235
|
+
op.send :output, :perform_called, out
|
236
|
+
value = op.perform_called
|
237
|
+
assert_equal out, value
|
238
|
+
assert_equal Hash, value.class
|
239
|
+
end
|
240
|
+
|
231
241
|
def test_it_raises_an_error_if_an_output_is_not_defined_but_is_set
|
232
242
|
op = ::MissingOutputOp.new
|
233
243
|
assert_raises ::Subroutine::Outputs::UnknownOutputError do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.0.
|
4
|
+
version: 0.10.0.beta8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|