Skip to content

Commit

Permalink
added spec to support ORMs with 'simple columns' (Neo4j)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnagir authored and joshuaclayton committed Jan 13, 2012
1 parent 591ec7a commit 5246fda
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions features/factory_girl_steps.feature
Expand Up @@ -215,3 +215,7 @@ Feature: Use step definitions generated by factories
And the post "Tagged post" should not have the following tags:
| name |
| funky |

Scenario: step definitions work correctly with ORMs that have simple `columns`
Given a simple column exists
Then there should be 1 SimpleColumn
19 changes: 19 additions & 0 deletions features/support/factories.rb
Expand Up @@ -58,6 +58,21 @@ class Tag < ActiveRecord::Base
class NonActiveRecord
end

class SimpleColumn
def self.columns
[:name]
end

def save!
@@count ||= 0
@@count += 1
end

def self.count
@@count
end
end

FactoryGirl.define do
# To make sure the step defs work with an email
sequence :email do |n|
Expand Down Expand Up @@ -90,6 +105,10 @@ class NonActiveRecord
# This is here to ensure that factory step definitions don't raise for a non-AR factory
factory :non_active_record do
end

# This is here to make FG work with ORMs that have `columns => [:name, :admin, :etc]` on the class (Neo4j)
factory :simple_column do
end
end

require 'factory_girl/step_definitions'
Expand Down

0 comments on commit 5246fda

Please sign in to comment.