Skip to content
Extraits de code Groupes Projets
factories.rb 1,47 ko
Newer Older
ilya's avatar
ilya a validé
#For Guidance
#http://github.com/thoughtbot/factory_girl
# http://railscasts.com/episodes/158-factories-not-fixtures
#This inclsion, because gpg-agent(not needed) is never run and hence never sets any env. variables on a MAC
ENV['GNUPGHOME'] = File.expand_path("../../gpg/diaspora-#{Rails.env}/", __FILE__)
GPGME::check_version({})

Factory.define :profile do |p|
  p.first_name "Robert"
  p.last_name "Grimm"
end

Factory.define :person do |p|
maxwell's avatar
maxwell a validé
  p.active true
  p.sequence(:url)  {|n|"http://google-#{n}.com/"}
maxwell's avatar
maxwell a validé
  p.key_fingerprint GPGME::list_keys("Wesley").first.subkeys.first.fingerprint
  p.profile Profile.new( :first_name => "Robert", :last_name => "Grimm" )
end

Factory.define :user do |u|
  u.sequence(:email) {|n| "bob#{n}@aol.com"}
  u.password "bluepin7"
  u.password_confirmation "bluepin7"
  u.key_fingerprint GPGME.list_keys("Smith", true).first.subkeys.first.fingerprint
  u.profile Profile.new( :first_name => "Bob", :last_name => "Smith" )
end
ilya's avatar
ilya a validé
Factory.define :status_message do |m|
  m.sequence(:message) {|n| "jimmy's #{n} whales"}
ilya's avatar
ilya a validé

Factory.define :blog do |b|
  b.sequence(:title) {|n| "bobby's #{n} penguins"}
  b.sequence(:body) {|n| "jimmy's huge #{n} whales"}
ilya's avatar
ilya a validé
end


Factory.define :bookmark do |b|
  b.link "http://www.yahooligans.com/"
end
Raphael's avatar
Raphael a validé
Factory.define :photo do |p|
  p.image File.open( File.dirname(__FILE__) + '/fixtures/bp.jpeg')

end
Factory.define(:comment) {}