lib/trailblazer/activity/testing.rb in trailblazer-activity-0.11.2 vs lib/trailblazer/activity/testing.rb in trailblazer-activity-0.11.3
- old
+ new
@@ -25,23 +25,25 @@
# task task: T.def_task(:create)
def self.def_task(name)
Module.new do
define_singleton_method(name) do | (ctx, flow_options), ** |
ctx[:seq] << name
- return Activity::Right, [ctx, flow_options]
+ signal = ctx.key?(name) ? ctx[name] : Activity::Right
+
+ return signal, [ctx, flow_options]
end
end.method(name)
end
def self.def_tasks(*names)
Module.new do
module_function
names.each do |name|
define_method(name) do | (ctx, flow_options), ** |
ctx[:seq] << name
- result = ctx.key?(name) ? ctx[name] : true
+ signal = ctx.key?(name) ? ctx[name] : Activity::Right
- return (result ? Activity::Right : Activity::Left), [ctx, flow_options]
+ return signal, [ctx, flow_options]
end
end
end
end