Created
April 13, 2016 18:25
-
-
Save ferblape/24083e3aa56c340740239a8d3e74704e to your computer and use it in GitHub Desktop.
Custom factory
This file contains hidden or 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
module Factories | |
def new_user(attrs = {}) | |
attrs[:email] ||= "[email protected]" | |
attrs[:password] ||= "foo123456" | |
attrs[:password_confirmation] ||= attrs[:password] | |
User.new(attrs) | |
end | |
def create_user(attrs = {}) | |
new_user(attrs).save! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment