2010-10-28 23:36:45 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Locomotive::Import::Job do
|
|
|
|
|
|
|
|
context 'when successful' do
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
@site = Factory(:site)
|
|
|
|
|
|
|
|
job = Locomotive::Import::Job.new(FixturedTheme.duplicate_and_open('default.zip'), @site, { :samples => true, :reset => true })
|
|
|
|
job.perform
|
|
|
|
|
|
|
|
job.success nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the site information' do
|
|
|
|
@site.name.should_not == "HTML5 portfolio"
|
|
|
|
@site.meta_keywords.should == "html5 portfolio theme locomotive cms"
|
|
|
|
@site.meta_description.should == "portfolio powered by html5"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'adds content types' do
|
|
|
|
@site.content_types.count.should == 2
|
|
|
|
content_type = @site.content_types.where(:slug => 'projects').first
|
2011-05-17 13:42:47 +00:00
|
|
|
content_type.content_custom_fields.size.should == 7
|
2010-10-28 23:36:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'converts correctly the order_by option for content types' do
|
|
|
|
content_type = @site.content_types.where(:slug => 'messages').first
|
2010-10-30 22:30:30 +00:00
|
|
|
content_type.order_by.should == 'created_at'
|
2010-10-28 23:36:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'adds samples coming with content types' do
|
|
|
|
content_type = @site.content_types.where(:slug => 'projects').first
|
|
|
|
content_type.contents.size.should == 5
|
|
|
|
|
|
|
|
content = content_type.contents.first
|
|
|
|
content.name.should == 'Locomotive App'
|
|
|
|
content.thumbnail.url.should_not be_nil
|
|
|
|
content.featured.should == true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'inserts theme assets' do
|
|
|
|
@site.theme_assets.count.should == 10
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'hides some theme assets' do
|
|
|
|
asset = @site.theme_assets.where(:local_path => 'stylesheets/style.css').first
|
|
|
|
asset.hidden.should == false
|
|
|
|
|
|
|
|
asset = @site.theme_assets.where(:local_path => 'stylesheets/ie7.css').first
|
|
|
|
asset.hidden.should == true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'inserts all the pages' do
|
2011-03-02 23:50:22 +00:00
|
|
|
@site.pages.count.should == 11
|
2010-10-28 23:36:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'inserts the index and 404 pages' do
|
2011-01-27 09:49:42 +00:00
|
|
|
@site.pages.root.first.should_not be_nil
|
2010-10-28 23:36:45 +00:00
|
|
|
@site.pages.not_found.first.should_not be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'inserts templatized page' do
|
|
|
|
page = @site.pages.where(:templatized => true).first
|
|
|
|
page.should_not be_nil
|
|
|
|
page.fullpath.should == 'portfolio/content_type_template'
|
|
|
|
end
|
|
|
|
|
2011-01-10 13:57:44 +00:00
|
|
|
it 'inserts redirection page' do
|
|
|
|
page = @site.pages.where(:redirect => true).first
|
|
|
|
page.should_not be_nil
|
|
|
|
page.redirect_url.should == 'http://blog.locomotivecms.com'
|
|
|
|
end
|
|
|
|
|
2010-10-28 23:36:45 +00:00
|
|
|
after(:all) do
|
|
|
|
Site.destroy_all
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|