flow 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/flow/rspec/shared_contexts/with_invalid_state.rb +42 -0
- data/lib/flow/rspec/shared_contexts.rb +1 -0
- data/lib/flow/state_proxy.rb +1 -1
- data/lib/flow/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2cbf274b4eeeec407044f9e1fa36f9adbb4e764c80fcddf8341faf71e2f579a
|
4
|
+
data.tar.gz: 3ba508665ba607fdabc7fe878199133ac5d194889eb4d911ec5b22656c47ef23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18ff6721175ce0189f883775bcc0953375837248ce8645c36ef5684d70f1dd47eb74cf5449c3a1e5d9dd0957058bd73a17dbd806108d2892218d42d40434c08
|
7
|
+
data.tar.gz: 7f60552c0bde342aa962eb6afee720f5d58cfe90ab63794457219c83a63724056833a6b482e81f192ee406288dc434f47ddd3b98e59b3eca0703ba5050d55746
|
data/README.md
CHANGED
@@ -216,12 +216,12 @@ If the `Flow` fails you can see the failures on the instance:
|
|
216
216
|
|
217
217
|
## Wiki
|
218
218
|
|
219
|
-
Learn more with our wiki [Getting Started](https://github.com/
|
219
|
+
Learn more with our wiki [Getting Started](https://github.com/RubyAfterAll/flow/wiki/Getting-Started#installation) page.
|
220
220
|
|
221
221
|
You also can download wiki to have offline access.
|
222
222
|
Just simply do:
|
223
223
|
|
224
|
-
`git clone git@github.com:
|
224
|
+
`git clone git@github.com:RubyAfterAll/flow.wiki.git`
|
225
225
|
|
226
226
|
|
227
227
|
## License
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Stubs a given flow to always fail when triggered.
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
# describe SomeFlow do
|
7
|
+
# let(:flow) { described_class.new(some: :arguments) }
|
8
|
+
#
|
9
|
+
# include_context "with invalid state"
|
10
|
+
#
|
11
|
+
# before { flow.trigger }
|
12
|
+
#
|
13
|
+
# it "is failed" do
|
14
|
+
# expect(flow).not_to be_successful
|
15
|
+
# expect(flow.state.errors).to be_present
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# Requires let variables to be defined in the inclusion context:
|
20
|
+
# * invalid_state_class - the state class that will be used for the flow
|
21
|
+
# * expected_state_errors - a hash in the form of:
|
22
|
+
# { attribute_name: :error_key
|
23
|
+
# # or:
|
24
|
+
# another_attributee: "error message!"
|
25
|
+
# }
|
26
|
+
RSpec.shared_context "with invalid state" do
|
27
|
+
before do
|
28
|
+
allow(invalid_state_class).to receive(:new).and_wrap_original do |mtd, **kwargs|
|
29
|
+
mtd.call(**kwargs).tap do |state|
|
30
|
+
allow(state).to receive(:run_validations!).and_wrap_original do |run_validations|
|
31
|
+
run_validations.call
|
32
|
+
|
33
|
+
expected_state_errors.each do |attr, error|
|
34
|
+
state.errors.add(attr, error)
|
35
|
+
end
|
36
|
+
|
37
|
+
false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/flow/state_proxy.rb
CHANGED
@@ -13,7 +13,7 @@ module Flow
|
|
13
13
|
|
14
14
|
ActiveSupport::Deprecation.warn(
|
15
15
|
"Direct state access of `#{method_name}' on #{_state.inspect} will be removed in a future version of flow. "\
|
16
|
-
"Use a state accessor instead - for more information see github/
|
16
|
+
"Use a state accessor instead - for more information see github/RubyAfterAll/flow/deprecation_notice"
|
17
17
|
)
|
18
18
|
_state.public_send(method_name, *arguments, &block)
|
19
19
|
end
|
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.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Jordan Minneti
|
10
10
|
- Vinod Lala
|
11
11
|
- Andrew Cross
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2022-03-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activemodel
|
@@ -338,6 +338,7 @@ files:
|
|
338
338
|
- lib/flow/rspec/custom_matchers/write_state.rb
|
339
339
|
- lib/flow/rspec/shared_contexts.rb
|
340
340
|
- lib/flow/rspec/shared_contexts/with_failing_operation.rb
|
341
|
+
- lib/flow/rspec/shared_contexts/with_invalid_state.rb
|
341
342
|
- lib/flow/rspec/shoulda_matcher_helper.rb
|
342
343
|
- lib/flow/spec_helper.rb
|
343
344
|
- lib/flow/state_base.rb
|
@@ -381,11 +382,11 @@ files:
|
|
381
382
|
- lib/generators/rspec/state/USAGE
|
382
383
|
- lib/generators/rspec/state/state_generator.rb
|
383
384
|
- lib/generators/rspec/state/templates/state_spec.rb.erb
|
384
|
-
homepage: https://github.com/
|
385
|
+
homepage: https://github.com/RubyAfterAll/flow
|
385
386
|
licenses:
|
386
387
|
- MIT
|
387
388
|
metadata: {}
|
388
|
-
post_install_message:
|
389
|
+
post_install_message:
|
389
390
|
rdoc_options: []
|
390
391
|
require_paths:
|
391
392
|
- lib
|
@@ -400,8 +401,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
401
|
- !ruby/object:Gem::Version
|
401
402
|
version: '0'
|
402
403
|
requirements: []
|
403
|
-
rubygems_version: 3.
|
404
|
-
signing_key:
|
404
|
+
rubygems_version: 3.3.9
|
405
|
+
signing_key:
|
405
406
|
specification_version: 4
|
406
407
|
summary: Write modular and reusable business logic that's understandable and maintainable.
|
407
408
|
test_files: []
|