1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

make sure the value is a string when calling #strip in step defs since cucumber > 1.0 yields real types instead of strings on matches

This commit is contained in:
Nick Quaranto 2011-07-28 17:22:51 -04:00
parent 49a47fa5de
commit d8aa63a471
3 changed files with 16 additions and 1 deletions

View file

@ -190,3 +190,11 @@ Feature: Use step definitions generated by factories
Then I should find the following for the last user:
| id | name |
| 123 | Joe |
Scenario: pass a factory girl table as an argument and modify it
Given these super users exist:
| id | Name |
| 123 | Joe |
Then I should find the following for the last user:
| id | name | admin |
| 123 | Joe | true |

View file

@ -16,3 +16,10 @@ end
When /^I create a "([^"]*)" instance from Factory Girl$/ do |factory_name|
FactoryGirl.create(factory_name)
end
Given /^these super users exist:$/ do |table|
headers = table.headers + ["admin"]
rows = table.rows.map { |row| row + [true] }
new_table = Cucumber::Ast::Table.new([headers] + rows)
Given %{the following person exists:}, new_table
end

View file

@ -21,7 +21,7 @@ module FactoryGirlStepHelpers
private
def process_key_value(key, value)
[key.downcase.gsub(' ', '_').to_sym, value.strip]
[key.downcase.gsub(' ', '_').to_sym, value.to_s.strip]
end
class AssociationManager