Skip to content

Instantly share code, notes, and snippets.

@dlchet
Created December 6, 2011 20:12
Show Gist options
  • Save dlchet/1439759 to your computer and use it in GitHub Desktop.
Save dlchet/1439759 to your computer and use it in GitHub Desktop.
# can be found in features/support/env.rb
require 'pp'
require 'features/support/user'
require 'factory_girl_rails'
# can be found in features/support/factories.rb
FactoryGirl.define do
factory :user do
name 'Adam Advertiser'
email '[email protected]'
end
end
pp FactoryGirl.create(:user)
require 'factory_girl/step_definitions'
$ rbenv exec cucumber
"Adam Advertiser"
"[email protected]"
#<User:0x101967808 @email="[email protected]", @name="Adam Advertiser">
Feature: a
Scenario: test factory-girl # features/user.feature:2
"Brandon"
"[email protected]"
Given the following user exists: # factory_girl-2.3.2/lib/factory_girl/step_definitions.rb:100
| name | email |
| Brandon | [email protected] |
1 scenario (1 passed)
1 step (1 passed)
0m0.004s
# can be found in features/user.feature
Feature: a
Scenario: test factory-girl
Given the following user exists:
| name | email |
| Brandon | [email protected] |
# can be found in features/support/user.rb
class User
attr_accessor :name, :email
def save!
pp @name
pp @email
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment