Module: TaskFactoryMethods
- Defined in:
- lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
Instance Method Summary collapse
Instance Method Details
#new_task(name, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb', line 2 def new_task(name, = {}) factory = [:factory] || :task attributes = [:attributes] || {} attributes.merge!({name: name}) set_task_defaults(attributes) @task = Factory(factory, attributes) @task.reload @task end |
#set_task_defaults(attributes) ⇒ Object
14 15 16 |
# File 'lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb', line 14 def set_task_defaults(attributes) attributes[:story_id] ||= @story.id if @story && !attributes[:story_id] end |