2010-04-09 09:23:41 +00:00
|
|
|
## Site ##
|
|
|
|
Factory.define :site do |s|
|
|
|
|
s.name 'Acme Website'
|
|
|
|
s.subdomain 'acme'
|
|
|
|
s.created_at Time.now
|
|
|
|
end
|
|
|
|
|
2010-08-01 09:55:01 +00:00
|
|
|
Factory.define "test site", :parent => :site do |s|
|
|
|
|
s.name 'Locomotive test website'
|
|
|
|
s.subdomain 'test'
|
|
|
|
s.after_build do |site_test|
|
2011-06-27 15:27:07 +00:00
|
|
|
site_test.memberships.build :account => Account.where(:name => "Admin").first || Factory("admin user"), :role => 'admin'
|
2010-08-01 09:55:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
Factory.define "another site", :parent => "test site" do |s|
|
|
|
|
s.name "Locomotive test website #2"
|
|
|
|
s.subdomain "test2"
|
|
|
|
end
|
2011-07-28 04:22:44 +00:00
|
|
|
|
|
|
|
Factory.define "existing site", :parent => "site" do |s|
|
|
|
|
s.name "Locomotive site with existing models"
|
|
|
|
s.subdomain "models"
|
|
|
|
s.after_build do |site_with_models|
|
|
|
|
site_with_models.content_types.build(
|
2011-08-13 23:24:02 +00:00
|
|
|
:slug => 'projects',
|
|
|
|
:name => 'Existing name',
|
2011-07-28 04:22:44 +00:00
|
|
|
:description => 'Existing description',
|
|
|
|
:order_by => 'created_at')
|
|
|
|
end
|
|
|
|
end
|
2011-08-13 23:24:02 +00:00
|
|
|
|
|
|
|
Factory.define "valid site", :parent => "site" do |s|
|
|
|
|
# s.after_build { |valid_site| valid_site.stubs(:valid?).returns(true) }
|
|
|
|
end
|
2010-08-01 10:37:49 +00:00
|
|
|
|
|
|
|
|
2010-04-13 13:24:12 +00:00
|
|
|
# Accounts ##
|
|
|
|
Factory.define :account do |a|
|
|
|
|
a.name 'Bart Simpson'
|
|
|
|
a.email 'bart@simpson.net'
|
|
|
|
a.password 'easyone'
|
|
|
|
a.password_confirmation 'easyone'
|
|
|
|
a.locale 'en'
|
|
|
|
end
|
2010-04-09 09:23:41 +00:00
|
|
|
|
2010-08-01 09:55:01 +00:00
|
|
|
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
|
|
|
|
|
2011-02-09 20:56:31 +00:00
|
|
|
Factory.define "brazillian user", :parent => :account do |a|
|
2011-02-21 16:45:53 +00:00
|
|
|
a.name "Jose Carlos"
|
2011-02-09 20:56:31 +00:00
|
|
|
a.email "jose@carlos.com.br"
|
|
|
|
a.locale 'pt-BR'
|
|
|
|
end
|
|
|
|
|
2011-05-04 11:13:55 +00:00
|
|
|
Factory.define "italian user", :parent => :account do |a|
|
|
|
|
a.name "Paolo Rossi"
|
|
|
|
a.email "paolo@paolo-rossi.it"
|
|
|
|
a.locale 'it'
|
|
|
|
end
|
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
|
2010-05-10 22:39:52 +00:00
|
|
|
## Memberships ##
|
|
|
|
Factory.define :membership do |m|
|
2011-06-27 15:27:07 +00:00
|
|
|
m.role 'admin'
|
|
|
|
m.account { Account.where(:name => "Bart Simpson").first || Factory('admin user') }
|
|
|
|
end
|
|
|
|
|
|
|
|
Factory.define :admin, :parent => :membership do |m|
|
|
|
|
m.role 'admin'
|
|
|
|
m.account { Factory('admin user', :locale => 'en') }
|
|
|
|
end
|
|
|
|
|
|
|
|
Factory.define :designer, :parent => :membership do |m|
|
|
|
|
m.role 'designer'
|
|
|
|
m.account { Factory('frenchy user', :locale => 'en') }
|
|
|
|
end
|
|
|
|
|
|
|
|
Factory.define :author, :parent => :membership do |m|
|
|
|
|
m.role 'author'
|
|
|
|
m.account { Factory('brazillian user', :locale => 'en') }
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
|
2010-04-25 00:33:38 +00:00
|
|
|
## Pages ##
|
|
|
|
Factory.define :page do |p|
|
|
|
|
p.title 'Home page'
|
2010-04-30 14:05:53 +00:00
|
|
|
p.slug 'index'
|
2010-08-01 10:55:30 +00:00
|
|
|
p.published true
|
|
|
|
p.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-05-02 23:33:17 +00:00
|
|
|
end
|
|
|
|
|
2010-08-01 12:00:34 +00:00
|
|
|
|
2010-05-02 23:33:17 +00:00
|
|
|
## Snippets ##
|
|
|
|
Factory.define :snippet do |s|
|
|
|
|
s.name 'My website title'
|
|
|
|
s.slug 'header'
|
2010-08-21 22:48:24 +00:00
|
|
|
s.template %{<title>Acme</title>}
|
2010-08-01 10:55:30 +00:00
|
|
|
s.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-05-11 21:38:52 +00:00
|
|
|
end
|
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
|
2011-06-21 00:39:59 +00:00
|
|
|
## Assets ##
|
|
|
|
Factory.define :asset do |a|
|
2010-08-01 10:55:30 +00:00
|
|
|
a.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-05-17 20:46:41 +00:00
|
|
|
end
|
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
|
2011-06-21 00:39:59 +00:00
|
|
|
## Theme assets ##
|
|
|
|
Factory.define :theme_asset do |a|
|
|
|
|
a.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-05-17 20:46:41 +00:00
|
|
|
end
|
2010-05-24 00:18:23 +00:00
|
|
|
|
2010-08-01 10:37:49 +00:00
|
|
|
|
2010-05-24 00:18:23 +00:00
|
|
|
## Content types ##
|
|
|
|
Factory.define :content_type do |t|
|
|
|
|
t.name 'My project'
|
2010-08-01 10:55:30 +00:00
|
|
|
t.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-05-24 00:18:23 +00:00
|
|
|
end
|
|
|
|
|