From 3c430357c95b436dbb06081fc039c4b005a26f9c Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Sat, 21 Dec 2024 16:39:39 +0100 Subject: [PATCH] naming. --- lib/trailblazer/test/assertion.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/trailblazer/test/assertion.rb b/lib/trailblazer/test/assertion.rb index ac5cbea..c602072 100644 --- a/lib/trailblazer/test/assertion.rb +++ b/lib/trailblazer/test/assertion.rb @@ -7,25 +7,23 @@ module Assertion # @private # Invoker for Operation - def self.invoke_activity(operation, ctx) + def self.invoke_operation(operation, ctx) result = operation.call(ctx) return result.terminus, result # translate the holy {Operation::Result} object back to a normal "circuit interface" return value. end - module Wtf - # @private - # Invoker with debugging for Operation - def self.invoke_activity(operation, ctx) - result = operation.wtf?(ctx) + # @private + # Invoker with debugging for Operation + def self.invoke_operation_with_wtf(operation, ctx) + result = operation.wtf?(ctx) - return result.terminus, result - end + return result.terminus, result end # DISCUSS: move to Assertion::Minitest? # Test case instance method. Specific to Minitest. - def assert_pass(activity, options, assertion: AssertPass, invoke: Assertion.method(:invoke_activity), model_at: :model, **kws, &block) + def assert_pass(activity, options, assertion: AssertPass, invoke: Assertion.method(:invoke_operation), model_at: :model, **kws, &block) # DISCUSS: remove the injectable {:assertion} keyword for both assertions? # DISCUSS: {:model_at} and {:invoke_method} block actual attributes. assertion.(activity, options, @@ -39,16 +37,16 @@ def assert_pass(activity, options, assertion: AssertPass, invoke: Assertion.meth # DISCUSS: move to Assertion::Minitest? # Test case instance method. Specific to Minitest. - def assert_fail(activity, options, *args, assertion: AssertFail, invoke: Assertion.method(:invoke_activity), **kws, &block) + def assert_fail(activity, options, *args, assertion: AssertFail, invoke: Assertion.method(:invoke_operation), **kws, &block) assertion.(activity, options, *args, test: self, user_block: block, invoke: invoke, **kws) # Forward {#assert_fail} to {AssertFail.call} or wherever your implementation sits. end def assert_pass?(*args, **options, &block) - assert_pass(*args, **options, invoke: Assertion::Wtf.method(:invoke_activity), &block) + assert_pass(*args, **options, invoke: Assertion.method(:invoke_operation_with_wtf), &block) end def assert_fail?(*args, **options, &block) - assert_fail(*args, **options, invoke: Assertion::Wtf.method(:invoke_activity), &block) + assert_fail(*args, **options, invoke: Assertion.method(:invoke_operation_with_wtf), &block) end # Evaluate value if it's a lambda, and let the caller know whether we need an