Sha256: 81943bd21be9cc93d33d181572c5901400ba2764b04032e710b9c059a2345928

Contents?: true

Size: 1.77 KB

Versions: 9

Compression:

Stored size: 1.77 KB

Contents

require 'spec_helper'

describe CssAsset do
  it "returns its assets when it has import in it" do
    asset = Asset.create(:path => 'spec/test_data/css/with-asset.css')
    
    asset.assets.should == [Asset.create(:path => 'spec/test_data/css/imported.css', :virtual_path => 'imported.css')] 
  end

  it "returns multiple assets when it has multiple imports" do
    actual = Asset.create(:path => 'spec/test_data/css/with-multiple-assets.css')
    expected = [
      Asset.create(:path => 'spec/test_data/css/imported.css', :virtual_path => 'imported.css'), 
      Asset.create(:path => 'spec/test_data/css/imported2.css',  :virtual_path => 'imported2.css')
    ] 

    actual.assets.should == expected
  end

  it "returns an image if it is within the css" do
    actual = Asset.create(:path => 'spec/test_data/css/image/with-image.css')
    expected = [ Asset.create(:path => 'spec/test_data/css/image/riding-you.jpg', :virtual_path => 'riding-you.jpg')] 

    actual.assets.should == expected
  end

  it "returns all recursive css imports and images under the css file" do
    expected = 
      [
        Asset.create(:path => 'spec/test_data/css/recursive/imported-lvl2.css', :virtual_path => 'imported-lvl2.css'),
        Asset.create(:path => 'spec/test_data/css/recursive/imported-lvl3.css', :virtual_path => 'imported-lvl3.css'),
        Asset.create(:path => 'spec/test_data/css/recursive/riding-you.jpg', :virtual_path => 'riding-you.jpg')
      ]
    asset = Asset.create(:path => 'spec/test_data/css/recursive/imported-recursive.css')
    actual = asset.assets

    actual.should == expected
  end

  it "does not return assets in comment" do
    expected = []
    asset = Asset.create(:path => 'spec/test_data/css/comments.css')
    actual = asset.assets

    actual.should == expected
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trackman-0.6.18 spec/css_asset_spec.rb
trackman-0.6.17 spec/css_asset_spec.rb
trackman-0.6.16 spec/css_asset_spec.rb
trackman-0.6.15 spec/css_asset_spec.rb
trackman-0.6.14 spec/css_asset_spec.rb
trackman-0.6.13 spec/css_asset_spec.rb
trackman-0.6.12 spec/css_asset_spec.rb
trackman-0.6.11 spec/css_asset_spec.rb
trackman-0.6.10 spec/css_asset_spec.rb