Spec: assets URLs in contents text fields should be correctly mapped.

This commit is contained in:
Pietro Giorgianni 2012-02-15 17:20:00 +01:00
parent d75604d654
commit a8b00b247b
2 changed files with 16 additions and 0 deletions

BIN
spec/fixtures/themes/default2.zip vendored Normal file

Binary file not shown.

View File

@ -137,4 +137,20 @@ describe Locomotive::Import::Job do
end
end
context 'with a content referencing an asset' do
before(:all) do
@site = FactoryGirl.create(:site)
job = Locomotive::Import::Job.new(FixturedTheme.duplicate_and_open('default2.zip'), @site, { :samples => true, :reset => true })
job.perform
job.success nil
end
it 'will fix the url inside content' do
content = @site.content_types.where(:slug => 'messages').first.contents.first
asset = @site.assets.first
content.message.should == "<img src=\"/sites/#{@site.id}/assets/#{asset.id}/#{asset.source_filename}\" />"
end
end
end