Sha256: a63df6c06f3ec34347ac43111a999ede9f6a21949e78030e35f65a8193505bd4

Contents?: true

Size: 948 Bytes

Versions: 16

Compression:

Stored size: 948 Bytes

Contents

module StoryFactoryMethods
  def new_story(name, options = {})
    factory = options[:factory] || :story
    attributes = options[:attributes] || {}
    
    attributes.merge!({name: name})
    set_story_defaults(attributes)
    @story = Factory(factory, attributes)
    
    @story.reload
  end
    
  def set_story_defaults(attributes)
    attributes[:offeror_id] ||= @me.id if @me && !attributes[:offeror_id]
    attributes[:project_id] ||= @project.id if @project && !attributes[:project_id]
  end
end

World(StoryFactoryMethods)

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

Given /^a story without tasks named "([^\"]*)"$/ do |name|
  new_story(name, factory: :story_without_tasks)
end

Then /^I should see the following stories:$/ 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/story_steps.rb
voluntary-0.5.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.4.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.3.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.2.4 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.2.3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.2.2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.2.1 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.2.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.1.0 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.1.0.rc4 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.1.0.rc3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.1.0.rc2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.1.0.rc1 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.0.3 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb
voluntary-0.0.2 lib/generators/voluntary/product_dummy/templates/features/step_definitions/story_steps.rb