Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make sure the value is a string when calling #strip in step defs sinc…

…e cucumber > 1.0 yields real types instead of strings on matches
  • Loading branch information...
commit d8aa63a4715ca01d8add0e5c0175167839728c27 1 parent 49a47fa
@nickrivadeneira nickrivadeneira authored
View
8 features/factory_girl_steps.feature
@@ -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
7 features/step_definitions/factory_girl_steps.rb
@@ -16,3 +16,10 @@
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
2  lib/factory_girl/step_definitions.rb
@@ -21,7 +21,7 @@ def attributes(strategy = CreateAttributes)
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
Please sign in to comment.
Something went wrong with that request. Please try again.