test/operation/persist_test.rb in trailblazer-2.0.0 vs test/operation/persist_test.rb in trailblazer-2.0.1
- old
+ new
@@ -9,16 +9,16 @@
extend Contract::DSL
contract do
property :title
end
- self.| Model( Song, :new )
- self.| Contract::Build()
- self.| Contract::Validate()
- self.< ->(options) { options["1. fail"] = "Validate" }
- self.| Contract::Persist()
- self.< ->(options) { options["2. fail"] = "Persist" }
+ step Model( Song, :new )
+ step Contract::Build()
+ step Contract::Validate()
+ failure ->(options) { options["1. fail"] = "Validate" }
+ step Contract::Persist()
+ failure ->(options) { options["2. fail"] = "Persist" }
end
it { Create.(title: "In Recital")["model"].title.must_equal "In Recital" }
it { Create.(title: "In Recital")["model"].saved.must_equal true }
# failure
@@ -33,10 +33,10 @@
#---
#- inheritance
class Update < Create
end
- it { Update["pipetree"].inspect.must_equal %{[>>operation.new,&model.build,>contract.build,&contract.default.params,&contract.default.validate,<PersistTest::Update:17,&persist.save,<PersistTest::Update:19]} }
+ it { Update["pipetree"].inspect.must_equal %{[>operation.new,>model.build,>contract.build,>contract.default.validate,<persist_test.rb:17,>persist.save,<persist_test.rb:19]} }
#---
it do
skip "show how save! could be applied and how we could rescue and deviate to left track"
end