Sha256: 20c4d9ee2961f72199d135cdb217f28123686585598bbcdf3f2d044fe6debb36

Contents?: true

Size: 724 Bytes

Versions: 16

Compression:

Stored size: 724 Bytes

Contents

module ProjectFactoryMethods
  def set_project_defaults(attributes)
    attributes[:user_id] ||= @me.id if @me && !attributes[:user_id]
    attributes[:product_id] ||= @product.id if @product && !attributes[:product_id]
    attributes[:area_ids] ||= [Area.last.id] if Area.any? && !attributes[:area_ids]
  end
end

World(ProjectFactoryMethods)

Given /^a project named "([^\"]*)"$/ do |name|
  attributes = {name: name}
  set_project_defaults(attributes)
  @project = Factory(:project, attributes)
  
  @project.reload
end

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