Sha256: 710b61debaac8c925bd488686152cc0844d7d5d00a7a214bfa47439ecb2b5295

Contents?: true

Size: 747 Bytes

Versions: 16

Compression:

Stored size: 747 Bytes

Contents

module TaskFactoryMethods
  def new_task(name, options = {})
    factory = options[:factory] || :task
    attributes = options[:attributes] || {}
    
    attributes.merge!({name: name})
    set_task_defaults(attributes)
    @task = Factory(factory, attributes)
    @task.reload
    
    @task
  end
    
  def set_task_defaults(attributes)
    attributes[:story_id] ||= @story.id if @story && !attributes[:story_id]
  end
end

World(TaskFactoryMethods)

Given /^a task named "([^\"]*)"$/ do |name|
  new_task(name)
end

Then /^I should see the following tasks:$/ do |expected_table|
  rows = find('table').all('tr')
  table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
  expected_table.diff!(table)
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
voluntary-0.5.1 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.5.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.4.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.3.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.2.4 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.2.3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.2.2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.2.1 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.2.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.1.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.1.0.rc4 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.1.0.rc3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.1.0.rc2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.1.0.rc1 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.0.3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb
voluntary-0.0.2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/task_steps.rb