hubbado-trailblazer 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +7 -1
- data/hubbado-trailblazer.gemspec +1 -1
- data/lib/hubbado/trailblazer/macro/{prepopulate_contract.rb → deserialize_contract_params.rb} +3 -3
- data/lib/hubbado/trailblazer/rspec_matchers/have_deserialized_params.rb +19 -0
- data/lib/hubbado-trailblazer.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c78de9e6399b2943e694031b7cfd30b6c13776944b37221fbe89a47518aeb6
|
4
|
+
data.tar.gz: 4fd46589064ce601305b990873d981554a50ee97b634b50ee97ca19478bf96f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d728feb3ee223119e4f32ef9efb908c5965e89d712b85d3f8984234d4abde74a280cd2638da7e539f65f566955ee991a38f786ceae1b855b9093a560e0ae1dc1
|
7
|
+
data.tar.gz: d89402e82251ce04726a280ebfbca988c295608ac48aba5125fd390d3bcc45dc6ef995119ea0756dcd580e7e3f987cf07f4196a250a88b831d13e89e6540e0e4
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.2.0] - 2025-07-19
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- rspec matcher `:have_deserialized_params` for DeserializeContractParams
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
- PrepopulateContract is renamed to DeserializeContractParams
|
17
|
+
|
8
18
|
## [1.1.0] - 2025-07-08
|
9
19
|
|
10
20
|
### Changed
|
data/README.md
CHANGED
@@ -137,10 +137,16 @@ Prepopulate Reform contracts with values from params without validation:
|
|
137
137
|
class Users::Edit < Trailblazer::Operation
|
138
138
|
step Model(User, :find)
|
139
139
|
step Contract::Build(constant: Users::UpdateContract)
|
140
|
-
step Hubbado::Trailblazer::Macro::
|
140
|
+
step Hubbado::Trailblazer::Macro::DeserializeContractParams()
|
141
141
|
end
|
142
142
|
```
|
143
143
|
|
144
|
+
In addition, there is a RSpec matcher `have_deserialized_params` for this macro and
|
145
|
+
has to be required manually:
|
146
|
+
```ruby
|
147
|
+
require 'hubbado/trailblazer/rspec_matchers/have_deserialized_params'
|
148
|
+
```
|
149
|
+
|
144
150
|
## Operation Tracing
|
145
151
|
|
146
152
|
Debug operation execution by setting the `TRACE_OPERATION` environment variable:
|
data/hubbado-trailblazer.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "hubbado-trailblazer"
|
3
|
-
s.version = "1.
|
3
|
+
s.version = "1.2.0"
|
4
4
|
s.summary = "Enhanced Trailblazer operation utilities for Ruby applications with improved error handling, operation execution patterns, and ActiveRecord integration."
|
5
5
|
|
6
6
|
s.authors = ["Hubbado Devs"]
|
data/lib/hubbado/trailblazer/macro/{prepopulate_contract.rb → deserialize_contract_params.rb}
RENAMED
@@ -7,9 +7,9 @@ module Hubbado
|
|
7
7
|
# For example, a contract, for a not yet saved assignment, might have
|
8
8
|
# timesheet approvers that depend on the client company ID in the
|
9
9
|
# contract
|
10
|
-
def self.
|
10
|
+
def self.DeserializeContractParams(key: nil)
|
11
11
|
task = ->((ctx, flow_options), _) do
|
12
|
-
ctx[:
|
12
|
+
ctx[:deserialized_params] = key || true
|
13
13
|
|
14
14
|
params = key ? ctx[:params][key] : ctx[:params]
|
15
15
|
|
@@ -20,7 +20,7 @@ module Hubbado
|
|
20
20
|
[::Trailblazer::Activity::Right, [ctx, flow_options]]
|
21
21
|
end
|
22
22
|
|
23
|
-
{ task: task, id: "
|
23
|
+
{ task: task, id: "DeserializeContractParams" }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hubbado
|
2
|
+
module Trailblazer
|
3
|
+
module RspecMatchers
|
4
|
+
module DeserializeContractParams
|
5
|
+
extend RSpec::Matchers::DSL
|
6
|
+
|
7
|
+
matcher :have_deserialized_params do |key: nil|
|
8
|
+
match(notify_expectation_failures: true) do |ctx|
|
9
|
+
expect(ctx[:deserialized_params]).to eq(key || true)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.configure do |rspec|
|
14
|
+
rspec.include self, type: :operation
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/hubbado-trailblazer.rb
CHANGED
@@ -11,4 +11,4 @@ require 'hubbado/trailblazer/trace_operation'
|
|
11
11
|
|
12
12
|
require 'hubbado/trailblazer/macro/decorate_model'
|
13
13
|
require 'hubbado/trailblazer/macro/policy'
|
14
|
-
require 'hubbado/trailblazer/macro/
|
14
|
+
require 'hubbado/trailblazer/macro/deserialize_contract_params'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubbado-trailblazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hubbado Devs
|
@@ -191,8 +191,9 @@ files:
|
|
191
191
|
- lib/hubbado/trailblazer.rb
|
192
192
|
- lib/hubbado/trailblazer/errors.rb
|
193
193
|
- lib/hubbado/trailblazer/macro/decorate_model.rb
|
194
|
+
- lib/hubbado/trailblazer/macro/deserialize_contract_params.rb
|
194
195
|
- lib/hubbado/trailblazer/macro/policy.rb
|
195
|
-
- lib/hubbado/trailblazer/
|
196
|
+
- lib/hubbado/trailblazer/rspec_matchers/have_deserialized_params.rb
|
196
197
|
- lib/hubbado/trailblazer/run_operation.rb
|
197
198
|
- lib/hubbado/trailblazer/trace_operation.rb
|
198
199
|
- lib/hubbado/trailblazer/transaction.rb
|
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
217
|
- !ruby/object:Gem::Version
|
217
218
|
version: '0'
|
218
219
|
requirements: []
|
219
|
-
rubygems_version: 3.6.
|
220
|
+
rubygems_version: 3.6.9
|
220
221
|
specification_version: 4
|
221
222
|
summary: Enhanced Trailblazer operation utilities for Ruby applications with improved
|
222
223
|
error handling, operation execution patterns, and ActiveRecord integration.
|