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