Fixed some failing dragonfly specs.
This commit is contained in:
parent
7f7ed896cf
commit
5c6794d69c
@ -13,4 +13,4 @@ module Locomotive
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Locomotive::Liquid::Filters::Resize do
|
||||
|
||||
before :each do
|
||||
@site = FactoryGirl.create(:site)
|
||||
@theme_asset = FactoryGirl.create(:theme_asset, :source => FixturedAsset.open('5k.png'), :site => @site)
|
||||
@ -10,13 +9,10 @@ describe Locomotive::Liquid::Filters::Resize do
|
||||
@asset_url = @asset.source.url
|
||||
@asset_path = "/sites/#{@asset.site_id}/assets/#{@asset.id}/5k.png"
|
||||
@context = Liquid::Context.new( { }, { 'asset_url' => @asset_url, 'theme_asset' => @theme_asset.to_liquid }, { :site => @site })
|
||||
@app = Locomotive::Dragonfly.app
|
||||
end
|
||||
|
||||
describe '#resize' do
|
||||
|
||||
context 'when an asset url string is given' do
|
||||
|
||||
before :each do
|
||||
@template = Liquid::Template.parse('{{ asset_url | resize: "40x30" }}')
|
||||
end
|
||||
@ -26,13 +22,11 @@ describe Locomotive::Liquid::Filters::Resize do
|
||||
end
|
||||
|
||||
it 'should use the path in the public folder to generate a location' do
|
||||
@template.render(@context).should == @app.fetch_file("public#{@asset_path}").thumb('40x30').url
|
||||
@template.render(@context).should == Locomotive::Dragonfly.resize_url(@asset_path, '40x30')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when a theme asset is given' do
|
||||
|
||||
before :each do
|
||||
@template = Liquid::Template.parse("{{ theme_asset | resize: '300x400' }}")
|
||||
end
|
||||
@ -42,13 +36,11 @@ describe Locomotive::Liquid::Filters::Resize do
|
||||
end
|
||||
|
||||
it 'should use the path of the theme asset to generate a location' do
|
||||
@template.render(@context).should == @app.fetch_file("public#{@theme_asset_path}").thumb('300x400').url
|
||||
@template.render(@context).should == Locomotive::Dragonfly.resize_url(@theme_asset_path, '300x400')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when no resize string is given' do
|
||||
|
||||
before :each do
|
||||
@template = Liquid::Template.parse('{{ asset | resize: }}')
|
||||
end
|
||||
@ -56,9 +48,6 @@ describe Locomotive::Liquid::Filters::Resize do
|
||||
it 'should return a liquid error' do
|
||||
@template.render(@context).should include 'Liquid error: wrong number of arguments'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user