lib/trailblazer/activity/testing.rb in trailblazer-activity-0.16.1 vs lib/trailblazer/activity/testing.rb in trailblazer-activity-0.16.2

- old
+ new

@@ -53,21 +53,23 @@ assert_call_for(signal, ctx, terminus: terminus, seq: seq, **expected_ctx_variables, **ctx_variables) end # Use {TaskWrap.invoke} to call the activity. - def assert_invoke(activity, terminus: :success, seq: "[]", circuit_options: {}, expected_ctx_variables: {}, **ctx_variables) - signal, (ctx, _flow_options) = Activity::TaskWrap.invoke( + def assert_invoke(activity, terminus: :success, seq: "[]", circuit_options: {}, flow_options: {}, expected_ctx_variables: {}, **ctx_variables) + signal, (ctx, returned_flow_options) = Activity::TaskWrap.invoke( activity, [ {seq: [], **ctx_variables}, - {} # flow_options + flow_options, ], **circuit_options ) assert_call_for(signal, ctx, terminus: terminus, seq: seq, **ctx_variables, **expected_ctx_variables) # DISCUSS: ordering of variables? + + return signal, [ctx, returned_flow_options] end def assert_call_for(signal, ctx, terminus: :success, seq: "[]", **ctx_variables) assert_equal signal.to_h[:semantic], terminus, "assert_call expected #{terminus} terminus, not #{signal}. Use assert_call(activity, terminus: #{signal.to_h[:semantic].inspect})" @@ -78,12 +80,10 @@ # Tests {:circuit} and {:outputs} fields so far. def assert_process_for(process, *args) semantics, circuit = args[0..-2], args[-1] - inspects = semantics.collect { |semantic| %(#<struct Trailblazer::Activity::Output signal=#<Trailblazer::Activity::End semantic=#{semantic.inspect}>, semantic=#{semantic.inspect}>) } - - assert_equal %([#{inspects.join(", ")}]), process.to_h[:outputs].inspect + assert_equal semantics.sort, process.to_h[:outputs].collect { |output| output[:semantic] }.sort assert_circuit(process, circuit) process end