diff --git a/test/operation/contract_test.rb b/test/operation/contract_test.rb index 6f19040..cb0504c 100644 --- a/test/operation/contract_test.rb +++ b/test/operation/contract_test.rb @@ -22,6 +22,11 @@ class Form < Reform::Form ->(*) { validate(options["params"][:song]) } # <-- TODO end + class UpdateHit < Update + step Contract::Persist( method: :sync ), id: 'persist.syncer' + step Contract::Persist() + end + # success it do result = Update.(params: {title: "SVG"}) @@ -38,6 +43,12 @@ class Form < Reform::Form result[:"result.contract.default"].errors.messages.must_equal({:title=>["can't be blank"]}) end + # override id + it 'override id' do + railway = Trailblazer::Developer.railway(UpdateHit) + assert_equal railway, %([>model.build,>contract.build,>contract.default.validate,>persist.syncer,>persist.save]) + end + #--- # Contract::Validate[key: :song] class Upsert < Trailblazer::Operation diff --git a/trailblazer-macro-contract.gemspec b/trailblazer-macro-contract.gemspec index bfcbe81..1e054d8 100644 --- a/trailblazer-macro-contract.gemspec +++ b/trailblazer-macro-contract.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.email = ["apotonick@gmail.com"] spec.description = 'Operation macros for form objects' spec.summary = 'Macros for form objects: Build, Validate, Persist' - spec.homepage = "http://trailblazer.to" + spec.homepage = "https://trailblazer.to" spec.license = "LGPL-3.0" spec.files = `git ls-files -z`.split("\x0").reject do |f|