2011-08-25 21:28:56 +00:00
|
|
|
FactoryGirl.define do
|
|
|
|
|
|
|
|
## Site ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :site, :class => Locomotive::Site do
|
2011-08-25 21:28:56 +00:00
|
|
|
name 'Acme Website'
|
2011-11-25 12:59:44 +00:00
|
|
|
subdomain 'acme'
|
2011-08-25 21:28:56 +00:00
|
|
|
created_at Time.now
|
|
|
|
|
|
|
|
factory "test site" do
|
|
|
|
name 'Locomotive test website'
|
2011-11-25 12:59:44 +00:00
|
|
|
subdomain 'test'
|
2011-08-25 21:28:56 +00:00
|
|
|
|
|
|
|
after_build do |site_test|
|
2011-11-20 11:47:41 +00:00
|
|
|
site_test.memberships.build :account => Locomotive::Account.where(:name => "Admin").first || Factory("admin user"), :role => 'admin'
|
2011-08-25 21:28:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory "another site" do
|
|
|
|
name "Locomotive test website #2"
|
2011-11-25 12:59:44 +00:00
|
|
|
subdomain "test2"
|
2011-08-25 21:28:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
factory "existing site" do
|
|
|
|
name "Locomotive site with existing models"
|
|
|
|
subdomain "models"
|
|
|
|
after_build do |site_with_models|
|
|
|
|
site_with_models.content_types.build(
|
|
|
|
:slug => 'projects',
|
|
|
|
:name => 'Existing name',
|
|
|
|
:description => 'Existing description',
|
|
|
|
:order_by => 'created_at')
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
factory "valid site" do
|
|
|
|
# after_build { |valid_site| valid_site.stubs(:valid?).returns(true) }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
# Accounts ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :account, :class => Locomotive::Account do
|
2011-08-25 21:28:56 +00:00
|
|
|
name 'Bart Simpson'
|
|
|
|
email 'bart@simpson.net'
|
|
|
|
password 'easyone'
|
|
|
|
password_confirmation 'easyone'
|
|
|
|
locale 'en'
|
|
|
|
|
|
|
|
factory "admin user" do
|
|
|
|
name "Admin"
|
|
|
|
email "admin@locomotiveapp.org"
|
|
|
|
end
|
|
|
|
|
|
|
|
factory "frenchy user" do
|
|
|
|
name "Jean Claude"
|
|
|
|
email "jean@frenchy.fr"
|
|
|
|
locale 'fr'
|
|
|
|
end
|
|
|
|
|
|
|
|
factory "brazillian user" do
|
|
|
|
name "Jose Carlos"
|
|
|
|
email "jose@carlos.com.br"
|
|
|
|
locale 'pt-BR'
|
|
|
|
end
|
|
|
|
|
|
|
|
factory "italian user" do
|
|
|
|
name "Paolo Rossi"
|
|
|
|
email "paolo@paolo-rossi.it"
|
|
|
|
locale 'it'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
## Memberships ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :membership, :class => Locomotive::Membership do
|
2011-08-25 21:28:56 +00:00
|
|
|
role 'admin'
|
2011-11-26 06:24:34 +00:00
|
|
|
account { Locomotive::Account.where(:name => "Bart Simpson").first || Factory('admin user') }
|
2011-08-25 21:28:56 +00:00
|
|
|
|
|
|
|
factory :admin do
|
|
|
|
role 'admin'
|
|
|
|
account { Factory('admin user', :locale => 'en') }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :designer do
|
|
|
|
role 'designer'
|
|
|
|
account { Factory('frenchy user', :locale => 'en') }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :author do
|
|
|
|
role 'author'
|
|
|
|
account { Factory('brazillian user', :locale => 'en') }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
## Pages ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :page, :class => Locomotive::Page do
|
2011-08-25 21:28:56 +00:00
|
|
|
title 'Home page'
|
|
|
|
slug 'index'
|
|
|
|
published true
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
2011-08-25 21:28:56 +00:00
|
|
|
|
|
|
|
factory :sub_page do
|
|
|
|
title 'Subpage'
|
|
|
|
slug 'subpage'
|
|
|
|
published true
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
|
|
|
parent { Locomotive::Page.where(:slug => "index").first || Factory(:page) }
|
2011-08-25 21:28:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
## Snippets ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :snippet, :class => Locomotive::Snippet do
|
2011-08-25 21:28:56 +00:00
|
|
|
name 'My website title'
|
|
|
|
slug 'header'
|
|
|
|
template %{<title>Acme</title>}
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
2010-08-01 09:55:01 +00:00
|
|
|
end
|
2011-08-25 21:28:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Assets ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :asset, :class => Locomotive::ContentAsset do
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
2011-08-25 21:28:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
## Theme assets ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :theme_asset, :class => Locomotive::ThemeAsset do
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
2011-08-25 21:28:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
## Content types ##
|
2011-11-20 11:25:01 +00:00
|
|
|
factory :content_type, :class => Locomotive::ContentType do
|
2011-08-25 21:28:56 +00:00
|
|
|
name 'My project'
|
2011-11-20 11:47:41 +00:00
|
|
|
site { Locomotive::Site.where(:subdomain => "acme").first || Factory(:site) }
|
2011-07-28 04:22:44 +00:00
|
|
|
end
|
2010-05-24 00:18:23 +00:00
|
|
|
|
2011-12-22 23:45:32 +00:00
|
|
|
factory :content_entry, :class => Locomotive::ContentEntry do
|
2011-10-24 12:52:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|