Sha256: 902aaebc36342874eea2f846d598e5966585a1c46793b61c4b5bb9bc3ae76a78

Contents?: true

Size: 1.53 KB

Versions: 11

Compression:

Stored size: 1.53 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')] 
  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'), 
      Asset.create(:path => 'spec/test_data/css/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')] 

    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'),
        Asset.create(:path => 'spec/test_data/css/recursive/imported-lvl3.css'),
        Asset.create(:path => 'spec/test_data/css/recursive/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

11 entries across 11 versions & 1 rubygems

Version Path
trackman-0.6.9 spec/css_asset_spec.rb
trackman-0.6.8 spec/css_asset_spec.rb
trackman-0.6.7 spec/css_asset_spec.rb
trackman-0.6.6 spec/css_asset_spec.rb
trackman-0.6.5 spec/css_asset_spec.rb
trackman-0.6.4 spec/css_asset_spec.rb
trackman-0.6.3 spec/css_asset_spec.rb
trackman-0.6.2 spec/css_asset_spec.rb
trackman-0.6.1 spec/css_asset_spec.rb
trackman-0.6.0 spec/css_asset_spec.rb
trackman-0.5.8 spec/css_asset_spec.rb