Adding a couple factories

This commit is contained in:
Jacques Crocker 2010-08-01 02:55:01 -07:00
parent 46b889b54b
commit 659c805ea9
1 changed files with 19 additions and 0 deletions

View File

@ -5,6 +5,14 @@ Factory.define :site do |s|
s.created_at Time.now
end
Factory.define "test site", :parent => :site do |s|
s.name 'Locomotive test website'
s.subdomain 'test'
s.after_build do |site_test|
site_test.memberships.build :account => Factory("admin user"), :admin => true
end
end
# Accounts ##
Factory.define :account do |a|
a.name 'Bart Simpson'
@ -14,6 +22,17 @@ Factory.define :account do |a|
a.locale 'en'
end
Factory.define "admin user", :parent => :account do |a|
a.name "Admin"
a.email "admin@locomotiveapp.org"
end
Factory.define "frenchy user", :parent => :account do |a|
a.name "Jean Claude"
a.email "jean@frenchy.fr"
a.locale 'fr'
end
## Memberships ##
Factory.define :membership do |m|
m.association :account, :factory => :account