flow 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -10
- data/lib/flow/version.rb +1 -1
- data/lib/generators/rspec/operation/templates/operation_spec.rb.erb +1 -2
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb00b50b5c0c19093beaf572f6e050e578b58fd83d5641f1b1dac553cb5096c5
|
4
|
+
data.tar.gz: 17ceb71b234ee7aebf897ff08ed11c2db68a1c63a9338322a9619f896c53e705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57537f1e3d84c95cc6018dafa17db38c71bc2b0ef606f25e67c9e875a9ca6196f604240e693cf808a227862266d6c5fc3b19c0edcfe8b29c3ae793ddbd8b37a0
|
7
|
+
data.tar.gz: 93386f65a3b4fc066c2d9d82b68be1f103290aaa63a7c0b356f0d8d9f5a6290aa80aaa8706da42450c3aff1f9904d56c280b11e0d00dc6b7f1c73a18ab2519dd
|
data/README.md
CHANGED
@@ -124,7 +124,7 @@ Ex: `FooBarBazFlow` assumes there is a defined `FooBarBazState`.
|
|
124
124
|
If you want to customize this behavior, define the state class explicitly:
|
125
125
|
|
126
126
|
```ruby
|
127
|
-
class ExampleFlow <
|
127
|
+
class ExampleFlow < ApplicationFlow
|
128
128
|
def self.state_class
|
129
129
|
MyCoolState
|
130
130
|
end
|
@@ -1062,7 +1062,7 @@ The easiest and best way to test an Operation is with a unit test.
|
|
1062
1062
|
|
1063
1063
|
Operation unit tests work best when you treat them like integration tests! (Read: **No Mocking!**)
|
1064
1064
|
|
1065
|
-
Operations are generated with the following
|
1065
|
+
Operations are generated with the following RSpec template:
|
1066
1066
|
|
1067
1067
|
```ruby
|
1068
1068
|
# frozen_string_literal: true
|
@@ -1076,8 +1076,7 @@ RSpec.describe MakeTheThingDoTheStuff, type: :operation do
|
|
1076
1076
|
let(:example_state_class) do
|
1077
1077
|
Class.new(ApplicationState) do
|
1078
1078
|
# argument :foo
|
1079
|
-
|
1080
|
-
# attribute :baz
|
1079
|
+
|
1081
1080
|
# output :gaz
|
1082
1081
|
end
|
1083
1082
|
end
|
@@ -1103,8 +1102,7 @@ In the boilerplate from the generator, there is the following snippet:
|
|
1103
1102
|
let(:example_state_class) do
|
1104
1103
|
Class.new(ApplicationState) do
|
1105
1104
|
# argument :foo
|
1106
|
-
|
1107
|
-
# attribute :baz
|
1105
|
+
|
1108
1106
|
# output :gaz
|
1109
1107
|
end
|
1110
1108
|
end
|
@@ -1122,21 +1120,23 @@ You are heavily encouraged *not* to do that. If your Operation is used by severa
|
|
1122
1120
|
|
1123
1121
|
Instead, use the spec as a way to communicate the contract of the Operation with the next developer. By boiling out a very clean example state that only includes what is necessary for the operation, you provide clear guidance on what the Operation's minimum requirements for a state are in a very transparent way.
|
1124
1122
|
|
1123
|
+
However, the emphasis is on _minimum_ requirements. `Option`s and `attribute`s are therefore discouraged in example states for operation specs, as well are contexts for when optional input is not provided. An operation designed for use with a State using optional inputs will _always_ require those methods to be available on its state class, so example states should always use arguments to define input.
|
1124
|
+
|
1125
1125
|
```ruby
|
1126
1126
|
let(:example_state_class) do
|
1127
1127
|
Class.new(ApplicationState) do
|
1128
1128
|
argument :foo
|
1129
|
-
|
1130
|
-
|
1129
|
+
argument :bar
|
1130
|
+
|
1131
1131
|
output :gaz
|
1132
1132
|
end
|
1133
1133
|
|
1134
1134
|
let(:state_input) do
|
1135
|
-
{ foo: foo
|
1135
|
+
{ foo: foo }
|
1136
1136
|
end
|
1137
1137
|
|
1138
1138
|
let(:foo) { ... }
|
1139
|
-
let(:bar) {
|
1139
|
+
let(:bar) { nil }
|
1140
1140
|
end
|
1141
1141
|
```
|
1142
1142
|
|
@@ -1183,7 +1183,11 @@ RSpec.describe FooState, type: :state do
|
|
1183
1183
|
# it { is_expected.to define_argument :necessary_input, allow_nil: false }
|
1184
1184
|
# it { is_expected.to define_option(:optional_input) }
|
1185
1185
|
# it { is_expected.to define_option(:option_with_default, default: :default_static_value) }
|
1186
|
+
|
1187
|
+
# let(:default_block_value) { SecureRandom.uuid }
|
1188
|
+
# before { allow(SecureRandom).to receive(:uuid).and_return(default_block_value) }
|
1186
1189
|
# it { is_expected.to define_option(:option_with_default_from_block, default: default_block_value) }
|
1190
|
+
|
1187
1191
|
# it { is_expected.to validate_presence_of ... }
|
1188
1192
|
# it { is_expected.to define_output :foo }
|
1189
1193
|
# it { is_expected.to define_output :foo, default: :bar }
|
data/lib/flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
@@ -12,48 +12,48 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2019-
|
15
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activemodel
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 5.2.1
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- - "
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: 5.2.1
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: activerecord
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- - "
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 5.2.1
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- - "
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: 5.2.1
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: activesupport
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- - "
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 5.2.1
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- - "
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 5.2.1
|
59
59
|
- !ruby/object:Gem::Dependency
|
@@ -166,14 +166,14 @@ dependencies:
|
|
166
166
|
requirements:
|
167
167
|
- - "~>"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 1.3
|
169
|
+
version: '1.3'
|
170
170
|
type: :development
|
171
171
|
prerelease: false
|
172
172
|
version_requirements: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - "~>"
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version: 1.3
|
176
|
+
version: '1.3'
|
177
177
|
- !ruby/object:Gem::Dependency
|
178
178
|
name: rspice
|
179
179
|
requirement: !ruby/object:Gem::Requirement
|
@@ -334,8 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
- !ruby/object:Gem::Version
|
335
335
|
version: '0'
|
336
336
|
requirements: []
|
337
|
-
|
338
|
-
rubygems_version: 2.7.6
|
337
|
+
rubygems_version: 3.0.3
|
339
338
|
signing_key:
|
340
339
|
specification_version: 4
|
341
340
|
summary: Write modular and reusable business logic that's understandable and maintainable.
|