trailblazer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +4 -0
- data/lib/trailblazer/operation.rb +4 -0
- data/lib/trailblazer/version.rb +1 -1
- data/test/operation_test.rb +18 -0
- data/trailblazer.gemspec +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 501c866e1640a0a821e4bbeaa38fbab80ef8c03d
|
4
|
+
data.tar.gz: b76816095a34ad206dbf1d74fbefd070957f73f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69aed732717c006c7a32f09fabbaa2ff886cb9fd4d6be4fccdf6dd0f81959415c440470705a008570f5e0ccf9bcc9dadfff4cb19e50babb04c0d2dcf77a75cc3
|
7
|
+
data.tar.gz: 769c47a8a86e3777c7bd6f13a4893b3fe969712be3e1eecfdaadd4f013c082d61abe9fbe2ca4a6cdf47bd69fe2e774a3b7cc4927352fe2601fb1a349007f6eff
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.2.2
|
2
|
+
|
3
|
+
# Added Operation#errors as every operation maintains a contract.
|
4
|
+
|
1
5
|
# 0.2.1
|
2
6
|
|
3
7
|
* Added `Operation#setup_model!(params)` that can be overridden to add nested objects or process models right after `model!`. Don't add deserialization logic here, let Reform/Representable do that.
|
data/README.md
CHANGED
@@ -467,6 +467,10 @@ Override `Operation#setup_model(params)` to add nested objects that can be infer
|
|
467
467
|
|
468
468
|
This is called right after `#model!`.
|
469
469
|
|
470
|
+
### Validation Errors
|
471
|
+
|
472
|
+
You can access the contracts `Errors` object via `Operation#errors`.
|
473
|
+
|
470
474
|
### ActiveModel Semantics
|
471
475
|
|
472
476
|
When using `Reform::Form::ActiveModel` (which is used automatically in a Rails environment to make form builders work) you need to invoke `model Comment` in the contract. This can be inferred automatically from the operation by including `CRUD::ActiveModel`.
|
data/lib/trailblazer/version.rb
CHANGED
data/test/operation_test.rb
CHANGED
@@ -340,3 +340,21 @@ class OperationInheritanceTest < MiniTest::Spec
|
|
340
340
|
song.band.must_equal nil
|
341
341
|
end
|
342
342
|
end
|
343
|
+
|
344
|
+
|
345
|
+
class OperationErrorsTest < MiniTest::Spec
|
346
|
+
class Operation < Trailblazer::Operation
|
347
|
+
contract do
|
348
|
+
property :title, validates: {presence: true}
|
349
|
+
end
|
350
|
+
|
351
|
+
def process(params)
|
352
|
+
validate(params, OpenStruct.new) {}
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
it do
|
357
|
+
res, op = Operation.run({})
|
358
|
+
op.errors.to_s.must_equal "{:title=>[\"can't be blank\"]}"
|
359
|
+
end
|
360
|
+
end
|
data/trailblazer.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Trailblazer::VERSION
|
9
9
|
spec.authors = ["Nick Sutterer"]
|
10
10
|
spec.email = ["apotonick@gmail.com"]
|
11
|
-
spec.description = %q{
|
12
|
-
spec.summary = %q{A
|
13
|
-
spec.homepage = ""
|
11
|
+
spec.description = %q{A high-level, modular architecture for Rails with domain and form objects, view models, twin decorators and representers.}
|
12
|
+
spec.summary = %q{A new architecture for Rails.}
|
13
|
+
spec.homepage = "http://www.trailblazerb.org"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -156,8 +156,8 @@ dependencies:
|
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
-
description:
|
160
|
-
|
159
|
+
description: A high-level, modular architecture for Rails with domain and form objects,
|
160
|
+
view models, twin decorators and representers.
|
161
161
|
email:
|
162
162
|
- apotonick@gmail.com
|
163
163
|
executables: []
|
@@ -209,7 +209,7 @@ files:
|
|
209
209
|
- test/uploaded_file_test.rb
|
210
210
|
- test/worker_test.rb
|
211
211
|
- trailblazer.gemspec
|
212
|
-
homepage:
|
212
|
+
homepage: http://www.trailblazerb.org
|
213
213
|
licenses:
|
214
214
|
- MIT
|
215
215
|
metadata: {}
|
@@ -232,7 +232,7 @@ rubyforge_project:
|
|
232
232
|
rubygems_version: 2.2.2
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
|
-
summary: A
|
235
|
+
summary: A new architecture for Rails.
|
236
236
|
test_files:
|
237
237
|
- test/crud_test.rb
|
238
238
|
- test/fixtures/apotomo.png
|