Created
November 5, 2009 20:47
-
-
Save jhsu/227362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :event_pool do |p| | |
p.name "Some event pool" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$: RAILS_ENV=test script/console | |
>> Factory(:user) | |
ActiveRecord::StatementInvalid: PGError: ERROR: null value in column "user_id" violates not-null constraint | |
: INSERT INTO "event_pools" ("name", "created_at", "updated_at", "user_id") VALUES(E'Some event pool', '2009-11-05 15:39:34.361234', '2009-11-05 15:39:34.361234', NULL) RETURNING "id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :user do |u| | |
u.email '[email protected]' | |
u.password 'somepassword' | |
u.password_confirmation 'somepassword' | |
# u.association :event_pool | |
end | |
# factory_girl creates associations first, thus user_id is NULL (thanks jferris via #thoughtbot IRC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment