Skip to content

Instantly share code, notes, and snippets.

@eladmeidar
Created November 3, 2014 18:10
Show Gist options
  • Save eladmeidar/fc034329b74e2175bd99 to your computer and use it in GitHub Desktop.
Save eladmeidar/fc034329b74e2175bd99 to your computer and use it in GitHub Desktop.
module TestFactories
def post_without_user(options={})
post_options = {title: 'Post title', body: 'Post bodies must be pretty long.'}.merge(options)
post = Post.new(post_options)
post.save
post
end
def authenticated_user
email = "email#{rand}@fake.com"
user = User.new(email: email, password: 'password')
user.skip_confirmation!
user.save
user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment