Module: Trailblazer::Activity::Testing
- Defined in:
- lib/trailblazer/activity/testing.rb
Overview
Helpers to quickly create steps and tasks.
Class Method Summary collapse
-
.def_steps(*names) ⇒ Object
Creates a module with one step method for each name.
-
.def_task(name) ⇒ Object
Creates a method instance with a task interface.
Class Method Details
.def_steps(*names) ⇒ Object
Creates a module with one step method for each name.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/trailblazer/activity/testing.rb', line 9 def self.def_steps(*names) Module.new do names.each do |name| define_method(name) do | ctx, ** | ctx[:seq] << name ctx.key?(name) ? ctx[name] : true end end end end |
.def_task(name) ⇒ Object
Creates a method instance with a task interface.
24 25 26 27 28 29 30 31 |
# File 'lib/trailblazer/activity/testing.rb', line 24 def self.def_task(name) Module.new do define_singleton_method(name) do | (ctx, ), ** | ctx[:seq] << name return Trailblazer::Activity::Right, [ctx, ] end end.method(name) end |