trailblazer-macro 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/trailblazer/macro/version.rb +1 -1
- data/test/docs/guard_test.rb +0 -24
- data/test/docs/rescue_test.rb +25 -0
- data/trailblazer-macro.gemspec +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4da758ccf1b9e9ff6fa413c687fe09c6df11449b84a775c65280a73d1b80f72
|
4
|
+
data.tar.gz: 23bd67cc32f045487ca761e15227fe562e87b7cde3616e7335a8ee3126c51217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4671b91a21144afc728dba8397282a49f6517d183349179a357da87e57a223cb4f5cb81f3d29f0bda0e3013db7581367e02a6de28a19bfbc7b83dd286a3f0d9a
|
7
|
+
data.tar.gz: 339a312f0c7f7bee0afe5f74b06d3694ff826daff2e5bbfe4190a3238252cd92feb36ab14cf2429814eaf5b18e50abdac18bee594b7229c37fc64df8856e18b8
|
data/CHANGES.md
CHANGED
data/test/docs/guard_test.rb
CHANGED
@@ -108,30 +108,6 @@ class DocsGuardNamedTest < Minitest::Spec
|
|
108
108
|
}
|
109
109
|
end
|
110
110
|
|
111
|
-
#---
|
112
|
-
# dependency injection
|
113
|
-
class DocsGuardInjectionTest < Minitest::Spec
|
114
|
-
#:di-op
|
115
|
-
class Create < Trailblazer::Operation
|
116
|
-
extend Trailblazer::Operation::Container
|
117
|
-
|
118
|
-
step Policy::Guard( ->(options, current_user:, **) { current_user == Module } )
|
119
|
-
end
|
120
|
-
#:di-op end
|
121
|
-
|
122
|
-
it { Create.(:current_user => Module).inspect("").must_equal %{<Result:true [nil] >} }
|
123
|
-
it {
|
124
|
-
result =
|
125
|
-
#:di-call
|
126
|
-
Create.(
|
127
|
-
{},
|
128
|
-
:current_user => Module,
|
129
|
-
:"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false })
|
130
|
-
)
|
131
|
-
#:di-call end
|
132
|
-
result.inspect("").must_equal %{<Result:false [nil] >} }
|
133
|
-
end
|
134
|
-
|
135
111
|
#---
|
136
112
|
# missing current_user throws exception
|
137
113
|
class DocsGuardMissingKeywordTest < Minitest::Spec
|
data/test/docs/rescue_test.rb
CHANGED
@@ -126,4 +126,29 @@ Rescue( handler: :instance_method )
|
|
126
126
|
it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
|
127
127
|
it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
|
128
128
|
end
|
129
|
+
|
130
|
+
=begin
|
131
|
+
Rescue(), fast_track: true {}
|
132
|
+
=end
|
133
|
+
class RescueWithFastTrack < Minitest::Spec
|
134
|
+
Memo = Class.new
|
135
|
+
|
136
|
+
#:rescue-fasttrack
|
137
|
+
class Memo::Create < Trailblazer::Operation
|
138
|
+
rescue_block = ->(*) {
|
139
|
+
step :update, Output(:failure) => End(:fail_fast)
|
140
|
+
step :rehash
|
141
|
+
}
|
142
|
+
|
143
|
+
step :find_model
|
144
|
+
step Rescue(&rescue_block), fail_fast: true
|
145
|
+
step :notify
|
146
|
+
fail :log_error
|
147
|
+
#~methods
|
148
|
+
include T.def_steps(:find_model, :update, :notify, :log_error, :rehash)
|
149
|
+
end
|
150
|
+
|
151
|
+
it { Memo::Create.( { seq: [], } ).inspect(:seq).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify]] >} }
|
152
|
+
it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{<Result:false [[:find_model, :update]] >} }
|
153
|
+
end
|
129
154
|
end
|
data/trailblazer-macro.gemspec
CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "roar"
|
26
26
|
spec.add_development_dependency "trailblazer-developer"
|
27
27
|
|
28
|
-
spec.add_dependency "trailblazer-activity", ">= 0.
|
29
|
-
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.
|
30
|
-
spec.add_dependency "trailblazer-operation", ">= 0.6.
|
28
|
+
spec.add_dependency "trailblazer-activity", ">= 0.11.2", "< 1.0.0"
|
29
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.3.3", "< 1.0.0"
|
30
|
+
spec.add_dependency "trailblazer-operation", ">= 0.6.5" # TODO: this dependency will be removed.
|
31
31
|
|
32
32
|
spec.required_ruby_version = ">= 2.2.0"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-macro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
- Marc Tich
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -101,7 +101,7 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.
|
104
|
+
version: 0.11.2
|
105
105
|
- - "<"
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: 1.0.0
|
@@ -111,7 +111,7 @@ dependencies:
|
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 0.
|
114
|
+
version: 0.11.2
|
115
115
|
- - "<"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.0.0
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.3.3
|
125
125
|
- - "<"
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: 1.0.0
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
requirements:
|
132
132
|
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: 0.
|
134
|
+
version: 0.3.3
|
135
135
|
- - "<"
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: 1.0.0
|
@@ -141,14 +141,14 @@ dependencies:
|
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.6.
|
144
|
+
version: 0.6.5
|
145
145
|
type: :runtime
|
146
146
|
prerelease: false
|
147
147
|
version_requirements: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.6.
|
151
|
+
version: 0.6.5
|
152
152
|
description: Macros for Trailblazer's operation
|
153
153
|
email:
|
154
154
|
- apotonick@gmail.com
|
@@ -192,7 +192,7 @@ homepage: http://trailblazer.to
|
|
192
192
|
licenses:
|
193
193
|
- LGPL-3.0
|
194
194
|
metadata: {}
|
195
|
-
post_install_message:
|
195
|
+
post_install_message:
|
196
196
|
rdoc_options: []
|
197
197
|
require_paths:
|
198
198
|
- lib
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
210
|
rubygems_version: 3.0.8
|
211
|
-
signing_key:
|
211
|
+
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: 'Macros for Trailblazer''s operation: Policy, Wrap, Rescue and more.'
|
214
214
|
test_files:
|