test/pipetree_test.rb in trailblazer-operation-0.0.4 vs test/pipetree_test.rb in trailblazer-operation-0.0.5

- old
+ new

@@ -52,31 +52,44 @@ #--- # ::>, ::<, ::>>, :& # with proc, method, callable. class Right < Trailblazer::Operation - self.> ->(input, options) { options[">"] = options["params"][:id] } + MyProc = ->(*) { } + self.> ->(options) { options[">"] = options["params"][:id] }, better_api: true self.> :method_name! def method_name!(options); self["method_name!"] = options["params"][:id] end class MyCallable include Uber::Callable - def call(operation, options); operation["callable"] = options["params"][:id] end + def call(options); options["callable"] = options["params"][:id] end end self.> MyCallable.new end it { Right.( id: 1 ).slice(">", "method_name!", "callable").must_equal [1, 1, 1] } - it { Right["pipetree"].inspect.must_equal %{[>>operation.new,>self,>return,>#<PipetreeTest::Right::MyCallable:>]} } + it { Right["pipetree"].inspect.must_equal %{[>>operation.new,>PipetreeTest::Right:58,>method_name!,>PipetreeTest::Right::MyCallable]} } #--- # inheritance class Righter < Right - self.> ->(input, options) { options["righter"] = true } + self.> ->(options) { options["righter"] = true } end it { Righter.( id: 1 ).slice(">", "method_name!", "callable", "righter").must_equal [1, 1, 1, true] } end +#--- +#- kw args +class OperationKwArgsTest < Minitest::Spec + Song = Struct.new(:id) -# args: operation, skills + class Create < Trailblazer::Operation + self.> ->(options) { options["model"] = "Object" } + # self.> ->(model:) { snippet } + end + + it { + skip + Create.() } +end