Skip to content
This repository
Browse code

Be more agnostic to ORMs when using columns. This will allow using FG…

… with neo4j still preserving semantics for other ORMs.
  • Loading branch information...
commit 591ec7afde160ab95c514eeca659af4f20208dc4 1 parent 8b3ee85
Dmytrii Nagirniak authored December 15, 2011 joshuaclayton committed January 13, 2012

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  lib/factory_girl/step_definitions.rb
7  lib/factory_girl/step_definitions.rb
@@ -114,13 +114,14 @@ def initialize(human_hash_to_attributes_hash, key, value)
114 114
 
115 115
     if factory.build_class.respond_to?(:columns)
116 116
       factory.build_class.columns.each do |column|
117  
-        human_column_name = column.name.downcase.gsub('_', ' ')
  117
+        name = column.respond_to?(:name) ? column.name : column.to_s
  118
+        human_column_name = name.downcase.gsub('_', ' ')
118 119
         Given /^an? #{human_name} exists with an? #{human_column_name} of "([^"]*)"$/i do |value|
119  
-          FactoryGirl.create(factory.name, column.name => value)
  120
+          FactoryGirl.create(factory.name, name => value)
120 121
         end
121 122
 
122 123
         Given /^(\d+) #{human_name.pluralize} exist with an? #{human_column_name} of "([^"]*)"$/i do |count, value|
123  
-          FactoryGirl.create_list(factory.name, count.to_i, column.name => value)
  124
+          FactoryGirl.create_list(factory.name, count.to_i, name => value)
124 125
         end
125 126
       end
126 127
     end

0 notes on commit 591ec7a

Please sign in to comment.
Something went wrong with that request. Please try again.