trailblazer-macro 2.1.0.rc12 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,36 +20,36 @@ class PolicyTest < Minitest::Spec
20
20
  step :process
21
21
 
22
22
  def process(options, **)
23
- options["process"] = true
23
+ options[:process] = true
24
24
  end
25
25
  end
26
26
 
27
27
  # successful.
28
28
  it do
29
29
  result = Create.(params: {}, current_user: Module)
30
- result["process"].must_equal true
30
+ result[:process].must_equal true
31
31
  #- result object, policy
32
- result["result.policy.default"].success?.must_equal true
33
- result["result.policy.default"]["message"].must_be_nil
32
+ result[:"result.policy.default"].success?.must_equal true
33
+ result[:"result.policy.default"][:message].must_be_nil
34
34
  # result[:valid].must_be_nil
35
- result["policy.default"].inspect.must_equal %{<Auth: user:Module, model:nil>}
35
+ result[:"policy.default"].inspect.must_equal %{<Auth: user:Module, model:nil>}
36
36
  end
37
37
  # breach.
38
38
  it do
39
39
  result = Create.(params: {}, current_user: nil)
40
- result["process"].must_be_nil
40
+ result[:process].must_be_nil
41
41
  #- result object, policy
42
- result["result.policy.default"].success?.must_equal false
43
- result["result.policy.default"]["message"].must_equal "Breach"
42
+ result[:"result.policy.default"].success?.must_equal false
43
+ result[:"result.policy.default"][:message].must_equal "Breach"
44
44
  end
45
45
  # inject different policy.Condition it { Create.(params: {}, current_user: Object, "policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))["process"].must_equal true }
46
- it { Create.(params: {}, current_user: Module, "policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))["process"].must_be_nil }
46
+ it { Create.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))[:process].must_be_nil }
47
47
 
48
48
 
49
49
  #---
50
50
  # inheritance, adding Model
51
51
  class Show < Create
52
- step Model( Song, :new ), before: "policy.default.eval"
52
+ step Model( Song, :new ), before: :"policy.default.eval"
53
53
  end
54
54
 
55
55
  it { Trailblazer::Developer.railway(Show).must_equal %{[>model.build,>policy.default.eval,>process]} }
@@ -57,7 +57,7 @@ class PolicyTest < Minitest::Spec
57
57
  # invalid because user AND model.
58
58
  it do
59
59
  result = Show.(params: {}, current_user: Module)
60
- result["process"].must_be_nil
60
+ result[:process].must_be_nil
61
61
  result[:model].inspect.must_equal %{#<struct PolicyTest::Song id=nil>}
62
62
  # result["policy"].inspect.must_equal %{#<struct PolicyTest::Song id=nil>}
63
63
  end
@@ -65,10 +65,10 @@ class PolicyTest < Minitest::Spec
65
65
  # valid because new policy.
66
66
  it do
67
67
  # puts Show["pipetree"].inspect
68
- result = Show.(params: {}, current_user: Module, "policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_and_model?))
69
- result["process"].must_equal true
68
+ result = Show.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_and_model?))
69
+ result[:process].must_equal true
70
70
  result[:model].inspect.must_equal %{#<struct PolicyTest::Song id=nil>}
71
- result["policy.default"].inspect.must_equal %{<Auth: user:Module, model:#<struct PolicyTest::Song id=nil>>}
71
+ result[:"policy.default"].inspect.must_equal %{<Auth: user:Module, model:#<struct PolicyTest::Song id=nil>>}
72
72
  end
73
73
 
74
74
  ##--
@@ -79,27 +79,27 @@ class PolicyTest < Minitest::Spec
79
79
  step :process
80
80
 
81
81
  def process(options, **)
82
- options["process"] = true
82
+ options[:process] = true
83
83
  end
84
84
  end
85
85
 
86
86
  # successful.
87
87
  it do
88
88
  result = Edit.(params: { id: 1 }, current_user: Module)
89
- result["process"].must_equal true
89
+ result[:process].must_equal true
90
90
  result[:model].inspect.must_equal %{#<struct PolicyTest::Song id=1>}
91
- result["result.policy.default"].success?.must_equal true
92
- result["result.policy.default"]["message"].must_be_nil
91
+ result[:"result.policy.default"].success?.must_equal true
92
+ result[:"result.policy.default"][:message].must_be_nil
93
93
  # result[:valid].must_be_nil
94
- result["policy.default"].inspect.must_equal %{<Auth: user:Module, model:#<struct PolicyTest::Song id=1>>}
94
+ result[:"policy.default"].inspect.must_equal %{<Auth: user:Module, model:#<struct PolicyTest::Song id=1>>}
95
95
  end
96
96
 
97
97
  # breach.
98
98
  it do
99
99
  result = Edit.(params: { id: 4 }, current_user: nil)
100
100
  result[:model].inspect.must_equal %{#<struct PolicyTest::Song id=4>}
101
- result["process"].must_be_nil
102
- result["result.policy.default"].success?.must_equal false
103
- result["result.policy.default"]["message"].must_equal "Breach"
101
+ result[:process].must_be_nil
102
+ result[:"result.policy.default"].success?.must_equal false
103
+ result[:"result.policy.default"][:message].must_equal "Breach"
104
104
  end
105
105
  end
@@ -1,9 +1,10 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require "trailblazer/macro"
3
+
1
4
  require "delegate" # Ruby 2.2
2
5
  require "minitest/autorun"
3
6
 
4
7
  require "trailblazer/developer"
5
- require "trailblazer/macro"
6
-
7
8
 
8
9
  module Mock
9
10
  class Result
@@ -39,7 +40,7 @@ T = Trailblazer::Activity::Testing
39
40
  module Rehash
40
41
  def rehash(ctx, seq:, rehash_raise: false, **)
41
42
  seq << :rehash
42
- raise if rehash_raise
43
+ raise "nope!" if rehash_raise
43
44
  true
44
45
  end
45
46
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = "Macros for Trailblazer's operation"
11
11
  spec.summary = "Macros for Trailblazer's operation: Policy, Wrap, Rescue and more."
12
12
  spec.homepage = "http://trailblazer.to"
13
- spec.license = "MIT"
13
+ spec.license = "LGPL-3.0"
14
14
 
15
15
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -18,9 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_development_dependency "bundler"
21
-
22
- # spec.add_development_dependency "trailblazer-operation", ">= 0.4.1", "< 0.5.0"
23
-
24
21
  spec.add_development_dependency "minitest"
25
22
  spec.add_development_dependency "rake"
26
23
 
@@ -28,8 +25,9 @@ Gem::Specification.new do |spec|
28
25
  spec.add_development_dependency "roar"
29
26
  spec.add_development_dependency "trailblazer-developer"
30
27
 
31
- spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.1.6", "< 0.2.0" # TODO: this dependency will be removed.
32
- spec.add_dependency "trailblazer-operation", ">= 0.5.2" # TODO: this dependency will be removed.
28
+ spec.add_dependency "trailblazer-activity", ">= 0.10.0", "< 1.0.0"
29
+ spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.2.7", "< 1.0.0"
30
+ spec.add_dependency "trailblazer-operation", ">= 0.6.2" # TODO: this dependency will be removed.
33
31
 
34
- spec.required_ruby_version = ">= 2.0.0"
32
+ spec.required_ruby_version = ">= 2.2.0"
35
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-macro
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.rc12
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-19 00:00:00.000000000 Z
12
+ date: 2020-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -95,40 +95,60 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: trailblazer-activity
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 0.10.0
105
+ - - "<"
106
+ - !ruby/object:Gem::Version
107
+ version: 1.0.0
108
+ type: :runtime
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 0.10.0
115
+ - - "<"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0
98
118
  - !ruby/object:Gem::Dependency
99
119
  name: trailblazer-activity-dsl-linear
100
120
  requirement: !ruby/object:Gem::Requirement
101
121
  requirements:
102
122
  - - ">="
103
123
  - !ruby/object:Gem::Version
104
- version: 0.1.6
124
+ version: 0.2.7
105
125
  - - "<"
106
126
  - !ruby/object:Gem::Version
107
- version: 0.2.0
127
+ version: 1.0.0
108
128
  type: :runtime
109
129
  prerelease: false
110
130
  version_requirements: !ruby/object:Gem::Requirement
111
131
  requirements:
112
132
  - - ">="
113
133
  - !ruby/object:Gem::Version
114
- version: 0.1.6
134
+ version: 0.2.7
115
135
  - - "<"
116
136
  - !ruby/object:Gem::Version
117
- version: 0.2.0
137
+ version: 1.0.0
118
138
  - !ruby/object:Gem::Dependency
119
139
  name: trailblazer-operation
120
140
  requirement: !ruby/object:Gem::Requirement
121
141
  requirements:
122
142
  - - ">="
123
143
  - !ruby/object:Gem::Version
124
- version: 0.5.2
144
+ version: 0.6.2
125
145
  type: :runtime
126
146
  prerelease: false
127
147
  version_requirements: !ruby/object:Gem::Requirement
128
148
  requirements:
129
149
  - - ">="
130
150
  - !ruby/object:Gem::Version
131
- version: 0.5.2
151
+ version: 0.6.2
132
152
  description: Macros for Trailblazer's operation
133
153
  email:
134
154
  - apotonick@gmail.com
@@ -143,7 +163,7 @@ files:
143
163
  - ".travis.yml"
144
164
  - CHANGES.md
145
165
  - Gemfile
146
- - LICENSE.txt
166
+ - LICENSE
147
167
  - README.md
148
168
  - Rakefile
149
169
  - lib/trailblazer-macro.rb
@@ -170,7 +190,7 @@ files:
170
190
  - trailblazer-macro.gemspec
171
191
  homepage: http://trailblazer.to
172
192
  licenses:
173
- - MIT
193
+ - LGPL-3.0
174
194
  metadata: {}
175
195
  post_install_message:
176
196
  rdoc_options: []
@@ -180,15 +200,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
200
  requirements:
181
201
  - - ">="
182
202
  - !ruby/object:Gem::Version
183
- version: 2.0.0
203
+ version: 2.2.0
184
204
  required_rubygems_version: !ruby/object:Gem::Requirement
185
205
  requirements:
186
- - - ">"
206
+ - - ">="
187
207
  - !ruby/object:Gem::Version
188
- version: 1.3.1
208
+ version: '0'
189
209
  requirements: []
190
- rubyforge_project:
191
- rubygems_version: 2.7.3
210
+ rubygems_version: 3.0.8
192
211
  signing_key:
193
212
  specification_version: 4
194
213
  summary: 'Macros for Trailblazer''s operation: Policy, Wrap, Rescue and more.'
@@ -1,27 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Trailblazer GmbH
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
22
-
23
- ---------
24
-
25
- Trailblazer Enterprise has a commercial-friendly license allowing private forks
26
- and modifications of Trailblazer. Please see http://trailblazer.to/enterprise/ for
27
- more detail.