Skip to content

Instantly share code, notes, and snippets.

@chenbojian
Last active March 13, 2016 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenbojian/7f15b97a90f63efe67ac to your computer and use it in GitHub Desktop.
Save chenbojian/7f15b97a90f63efe67ac to your computer and use it in GitHub Desktop.
learn ruby
require 'factory_girl'
require 'securerandom'
FactoryGirl.define do
factory :user do
haha SecureRandom.hex(10)
hehe 88
end
end
class User
attr_accessor 'haha', 'hehe'
end
p FactoryGirl.build(:user)
p FactoryGirl.build(:user, hehe: 17)
p FactoryGirl.build(:user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment