diff --git a/lib/trailblazer/endpoint/runtime.rb b/lib/trailblazer/endpoint/runtime.rb index 4561fb8..bef30f3 100644 --- a/lib/trailblazer/endpoint/runtime.rb +++ b/lib/trailblazer/endpoint/runtime.rb @@ -5,7 +5,7 @@ module Runtime # We run the Adapter here, which in turn will run your business operation, then the matcher # or whatever you have configured. - def call(protocol, ctx, flow_options: {}, matcher_context:, default_matcher:, matcher_extension: Matcher.Extension(), &block) # TODO: test {flow_options} + def call(activity, ctx, flow_options: {}, matcher_context:, default_matcher:, matcher_extension: Matcher.Extension(), &block) # TODO: test {flow_options} matcher = Trailblazer::Endpoint::Matcher::DSL.new.instance_exec(&block) matcher_value = Trailblazer::Endpoint::Matcher::Value.new(default_matcher, matcher, matcher_context) @@ -18,11 +18,11 @@ def call(protocol, ctx, flow_options: {}, matcher_context:, default_matcher:, ma pipeline = Activity::TaskWrap::Pipeline.new(in_extension + [matcher_extension]) # DISCUSS: how and where to run the matcher, especially with an protocol. - container_activity = Activity::TaskWrap.container_activity_for(protocol, wrap_static: pipeline) + container_activity = Activity::TaskWrap.container_activity_for(activity, wrap_static: pipeline) # Trailblazer::Activity::TaskWrap.invoke( # FIXME: run Advance using this, not its own wtf?/call invocation. Trailblazer::Developer.wtf?( # FIXME: run Advance using this, not its own wtf?/call invocation. - protocol, + activity, [ ctx, flow_options.merge(matcher_value: matcher_value) # matchers will be executed in Adapter's taskWrap. @@ -30,7 +30,7 @@ def call(protocol, ctx, flow_options: {}, matcher_context:, default_matcher:, ma container_activity: container_activity, exec_context: self, - # wrap_runtime: {protocol => ->(*) { snippet }} # TODO: use wrap_runtime once https://github.com/trailblazer/trailblazer-developer/issues/46 is fixed. + # wrap_runtime: {activity => ->(*) { snippet }} # TODO: use wrap_runtime once https://github.com/trailblazer/trailblazer-developer/issues/46 is fixed. ) end end # Runtime diff --git a/test/runtime_test.rb b/test/runtime_test.rb index 26c2e80..86657f6 100644 --- a/test/runtime_test.rb +++ b/test/runtime_test.rb @@ -23,7 +23,7 @@ class Protocol < Trailblazer::Endpoint::Protocol include T.def_steps(:authenticate, :policy) end - it "{Runtime.call}" do + it "{Runtime.call} matcher block" do default_matcher = { success: ->(*) { raise }, not_found: ->(ctx, model:, **) { render "404, #{model} not found" }, @@ -67,8 +67,6 @@ class Protocol < Trailblazer::Endpoint::Protocol # assert_equal @rendered, %(404, false not found) end - #,mljnimh - # endpoint "bla", ctx: {} do # success do |ctx, model:, **| # render model.inspect