diff --git a/lib/trailblazer/macro/nested.rb b/lib/trailblazer/macro/nested.rb index d5de136..ecc60bf 100644 --- a/lib/trailblazer/macro/nested.rb +++ b/lib/trailblazer/macro/nested.rb @@ -104,7 +104,7 @@ def self.call_dynamic_nested_activity((ctx, flow_options), runner:, **circuit_op def self.compute_legacy_return_signal(return_signal) actual_semantic = return_signal.to_h[:semantic] - applied_signal = SUCCESS_SEMANTICS.include?(actual_semantic) ? Activity::Right : Activity::Left # TODO: we could also provide PassFast/FailFast. + _applied_signal = SUCCESS_SEMANTICS.include?(actual_semantic) ? Activity::Right : Activity::Left # TODO: we could also provide PassFast/FailFast. end # This is used in Nested and Each where some tasks don't have a corresponding, hard-wired diff --git a/test/docs/each_test.rb b/test/docs/each_test.rb index ffb68df..32c63c9 100644 --- a/test/docs/each_test.rb +++ b/test/docs/each_test.rb @@ -711,7 +711,7 @@ class Validate < Trailblazer::Activity::Railway assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each-1"])[0].id, "Each-1" assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each/composers_for_each"])[0].id, "Each/composers_for_each" - assert_match /Each\/\w+/, Trailblazer::Activity::Introspect::Nodes(activity).values[1].id # FIXME: this test sucks. + assert_match (/Each\/\w+/), Trailblazer::Activity::Introspect::Nodes(activity).values[1].id # FIXME: this test sucks. end end @@ -740,7 +740,7 @@ def self.block ctx = {seq: [], dataset: [3,2,1]} - stack, signal, (ctx, _) = Trailblazer::Developer::Trace.invoke(activity, [ctx, {}]) + stack, _signal, (_ctx, _) = Trailblazer::Developer::Trace.invoke(activity, [ctx, {}]) output = Trailblazer::Developer::Trace::Present.(stack) do |trace_nodes:, **| {node_options: {trace_nodes[0] => {label: ""}}} @@ -790,7 +790,7 @@ def self.block } # signal, (_ctx, _) = Trailblazer::Activity::TaskWrap.invoke(activity, [ctx]) - signal, (_ctx, _) = Trailblazer::Developer.wtf?(activity, [ctx], exec_context: my_exec_context) + _signal, (_ctx, _) = Trailblazer::Developer.wtf?(activity, [ctx], exec_context: my_exec_context) assert_equal _ctx[:collected_from_each], ["1-0", "2-1", "3-2"] end diff --git a/test/docs/guard_test.rb b/test/docs/guard_test.rb index 45a4933..06b1fd1 100644 --- a/test/docs/guard_test.rb +++ b/test/docs/guard_test.rb @@ -27,7 +27,7 @@ def process(options, **) #--- #- Guard inheritance class New < Create - step Policy::Guard( ->(options, current_user:, **) { current_user } ), override: true + step Policy::Guard( ->(options, current_user:, **) { current_user } ), replace: :"policy.default.eval" end it { assert_equal Trailblazer::Developer.railway(New), %{[>policy.default.eval,>process]} } diff --git a/test/docs/model/find_test.rb b/test/docs/model/find_test.rb index 29150d6..62a8529 100644 --- a/test/docs/model/find_test.rb +++ b/test/docs/model/find_test.rb @@ -29,7 +29,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:find_by_id-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: "1"}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: "1"}, seq: []) ctx[:model] #=> # #:find_by_id-invoke end @@ -37,14 +37,14 @@ class Update < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: nil}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: nil}, seq: []) assert_equal ctx[:model].inspect, %{nil} end #~ctx_to_result end # TODO: put this test somewhere else it "doesn't leak anything but {:model} to the outer world" do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: "1"}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: "1"}, seq: []) assert_equal ctx.keys.inspect, %([:params, :seq, :model]) end @@ -75,7 +75,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:find_by_column-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: "1f396"}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: "1f396"}, seq: []) ctx[:model] #=> # #:find_by_column-invoke end @@ -83,7 +83,7 @@ class Update < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: nil}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {short_id: nil}, seq: []) assert_equal ctx[:model].inspect, %{nil} end #~ctx_to_result end @@ -108,7 +108,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:params_key-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {slug: "1f396"}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {slug: "1f396"}, seq: []) ctx[:model] #=> # #:params_key-invoke end @@ -116,7 +116,7 @@ class Update < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {slug: nil}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {slug: nil}, seq: []) assert_equal ctx[:model].inspect, %{nil} end #~ctx_to_result end @@ -146,7 +146,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:find_with-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: 2}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: 2}, seq: []) ctx[:model] #=> # #:find_with-invoke end @@ -154,7 +154,7 @@ class Update < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: nil}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: nil}, seq: []) assert_equal ctx[:model].inspect, %{nil} end #~ctx_to_result end @@ -186,7 +186,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:id_from-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {song: {id: "1f396"}}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {song: {id: "1f396"}}, seq: []) ctx[:model] #=> # #:id_from-invoke end @@ -195,7 +195,7 @@ class Update < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {}, seq: []) assert_equal ctx[:model].inspect, %{nil} assert_equal ctx[:seq].inspect, %([]) @@ -227,7 +227,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:find-ok - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, {params: {id: 1}, seq: []}) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, {params: {id: 1}, seq: []}) ctx[:model] #=> # #:find-ok end @@ -259,7 +259,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:show-ok - signal, (ctx, _) = Trailblazer::Developer.wtf?(Song::Activity::Update, [{params: {id: 1}, seq: []}]) + _signal, (ctx, _) = Trailblazer::Developer.wtf?(Song::Activity::Update, [{params: {id: 1}, seq: []}]) ctx[:model] #=> # #:show-ok end @@ -326,7 +326,7 @@ class Create < Trailblazer::Activity::Railway #~ctx_to_result it do #:new-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) ctx[:model] #=> # #:new-invoke end @@ -356,7 +356,7 @@ class Create < Trailblazer::Activity::Railway #~ctx_to_result it do #:build-invoke - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) ctx[:model] #=> # #:build-invoke end @@ -389,7 +389,7 @@ class Update < Trailblazer::Activity::Railway assert_invoke Song::Activity::Update, params: {id: nil}, terminus: :not_found #:not-found-invoke - signal, (ctx, _) = Trailblazer::Activity::TaskWrap.invoke(Song::Activity::Update, [{params: {id: nil}},{}]) + signal, (_ctx, _) = Trailblazer::Activity::TaskWrap.invoke(Song::Activity::Update, [{params: {id: nil}},{}]) puts signal #=> # #:not-found-invoke end end diff --git a/test/docs/model_test.rb b/test/docs/model_test.rb index 219fbdc..084c0ba 100644 --- a/test/docs/model_test.rb +++ b/test/docs/model_test.rb @@ -51,7 +51,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:create - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, seq: []) puts ctx[:model] #=> # #:create end @@ -102,7 +102,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:update-with-find-by-key-ok - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {title: "Test"}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {title: "Test"}, seq: []) ctx[:model] #=> # #:update-with-find-by-key-ok end @@ -111,7 +111,7 @@ class Update < Trailblazer::Activity::Railway it do #:key-title-fail - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {title: nil}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {title: nil}, seq: []) assert_equal ctx[:model].inspect, %{nil} #:key-title-fail end @@ -138,7 +138,7 @@ class Update < Trailblazer::Activity::Railway #~ctx_to_result it do #:show-ok - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: 1}, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: 1}, seq: []) ctx[:model] #=> # #:show-ok end @@ -166,14 +166,14 @@ class Hit < Song end #:di-model-class - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, :"model.class" => Hit, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, :"model.class" => Hit, seq: []) #:di-model-class end assert_equal ctx[:model].inspect, %{#} # inject all variables #:di-all - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {title: "Olympia"}, # some random variable. "model.class": Hit, "model.action": :find_by, @@ -203,7 +203,7 @@ class Create < Trailblazer::Activity::Railway end it do - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, :"model.class" => Hit, seq: []) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, :"model.class" => Hit, seq: []) assert_equal ctx[:model].inspect, %{#} end @@ -224,7 +224,7 @@ class Create < Trailblazer::Operation end #:in end - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, my_id: 1, :"model.class" => Hit) + _signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, my_id: 1, :"model.class" => Hit) assert_equal ctx[:model].inspect, %{#} =begin @@ -233,7 +233,7 @@ class Create < Trailblazer::Operation #:in-call end =end end - end +end end class Model404TerminusTest < Minitest::Spec @@ -257,7 +257,7 @@ class Update < Trailblazer::Activity::Railway assert_invoke Song::Activity::Update, params: {id: nil}, terminus: :not_found #:not_found - signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: nil}) + signal, (_ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: nil}) puts signal #=> # #:not_found end end @@ -286,7 +286,7 @@ class Update < Trailblazer::Activity::Railway assert_invoke Song::Activity::Update, params: {id: nil}, terminus: :not_found #:not_found - signal, (ctx, _) = Trailblazer::Activity::TaskWrap.invoke(Song::Activity::Update, [{params: {id: nil}},{}]) + signal, (_ctx, _) = Trailblazer::Activity::TaskWrap.invoke(Song::Activity::Update, [{params: {id: nil}},{}]) puts signal #=> # #:not_found end end diff --git a/test/docs/nested_static_test.rb b/test/docs/nested_static_test.rb index e224312..54c7d53 100644 --- a/test/docs/nested_static_test.rb +++ b/test/docs/nested_static_test.rb @@ -699,7 +699,7 @@ class NestedStrategyComplianceTest < Minitest::Spec ] ) #:create-introspect end - assert_match /user_proc=encode_id3>/, output + assert_match (/user_proc=encode_id3>/), output end # TODO: test more options. diff --git a/test/docs/pundit_test.rb b/test/docs/pundit_test.rb index b263b7e..4804f64 100644 --- a/test/docs/pundit_test.rb +++ b/test/docs/pundit_test.rb @@ -61,7 +61,7 @@ class Edit < Trailblazer::Operation end class Update < Edit - step Policy::Pundit( MyPolicy, :new?, name: "first" ), override: true + step Policy::Pundit( MyPolicy, :new?, name: "first" ), replace: :"policy.first.eval" end it { assert_equal Trailblazer::Developer.railway(Edit), %{[>policy.first.eval,>policy.second.eval]} } diff --git a/test/docs/rescue_test.rb b/test/docs/rescue_test.rb index 4ab7a12..e603697 100644 --- a/test/docs/rescue_test.rb +++ b/test/docs/rescue_test.rb @@ -23,7 +23,7 @@ class NestedInsanity < Trailblazer::Operation fail ->(options, **) { options["outer-err"] = true }, id: "nested/failure" end - it { assert_match /\[>Rescue\/.{1,3},>nested/, Trailblazer::Developer.railway(NestedInsanity) } # FIXME: better introspect tests for all id-generating macros. + it { assert_match (/\[>Rescue\/.{1,3},>nested/), Trailblazer::Developer.railway(NestedInsanity) } # FIXME: better introspect tests for all id-generating macros. it { assert_equal NestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } it { assert_equal NestedInsanity.( "raise-y" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } it { assert_equal NestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} }