From fa138b28d0bb12c727025d98eaaf91b4aef931c8 Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Sat, 26 Nov 2011 16:22:48 +1100 Subject: [PATCH] Fixed some failing export specs. --- lib/locomotive/export.rb | 14 +++++++------- lib/locomotive/import/job.rb | 6 +++--- spec/lib/locomotive/export_spec.rb | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/locomotive/export.rb b/lib/locomotive/export.rb index 602e2440..398d8284 100644 --- a/lib/locomotive/export.rb +++ b/lib/locomotive/export.rb @@ -20,8 +20,8 @@ module Locomotive def run! self.initialize_site_hash - self.log('copying assets') - self.copy_assets + self.log('copying content assets') + self.copy_content_assets self.log('copying theme assets') self.copy_theme_assets @@ -163,10 +163,10 @@ module Locomotive end end - def copy_assets - @site.assets.each do |asset| - target_path = File.join(self.samples_folder, asset.source_filename) - self.copy_file_from_an_uploader(asset.source, target_path) + def copy_content_assets + @site.content_assets.each do |content_asset| + target_path = File.join(self.samples_folder, content_asset.source_filename) + self.copy_file_from_an_uploader(content_asset.source, target_path) end end @@ -340,4 +340,4 @@ module Locomotive end -end \ No newline at end of file +end diff --git a/lib/locomotive/import/job.rb b/lib/locomotive/import/job.rb index 62f1ab61..63e2cb43 100644 --- a/lib/locomotive/import/job.rb +++ b/lib/locomotive/import/job.rb @@ -42,7 +42,7 @@ module Locomotive self.reset! if @options[:reset] - %w(site content_types assets snippets pages).each do |step| + %w(site content_types content_assets snippets pages).each do |step| if @options[:enabled][step] != false "Locomotive::Import::#{step.camelize}".constantize.process(context, @options) @worker.update_attributes :step => step if @worker @@ -162,7 +162,7 @@ module Locomotive def reset! @site.pages.destroy_all - @site.assets.destroy_all + @site.content_assets.destroy_all @site.theme_assets.destroy_all @site.content_types.destroy_all end @@ -176,4 +176,4 @@ module Locomotive end end -end \ No newline at end of file +end diff --git a/spec/lib/locomotive/export_spec.rb b/spec/lib/locomotive/export_spec.rb index 6faa2b63..cfabb54d 100644 --- a/spec/lib/locomotive/export_spec.rb +++ b/spec/lib/locomotive/export_spec.rb @@ -6,7 +6,7 @@ describe Locomotive::Export do before(:each) do site = FactoryGirl.build('another site') - Site.stubs(:find).returns(site) + Locomotive::Site.stubs(:find).returns(site) project_type = build_project_type(site) project_type.contents.build(:title => 'Project #1', :description => 'Lorem ipsum', :active => true) project_type.contents.build(:title => 'Project #2', :description => 'More Lorem ipsum', :active => false) @@ -120,9 +120,9 @@ describe Locomotive::Export do after(:all) do FileUtils.rm_rf(self.zip_folder) if File.exists?(self.zip_folder) - Site.destroy_all + Locomotive::Site.destroy_all end end -end \ No newline at end of file +end