Sha256: c8aa06961b92d1e554535701c47f6621a0fe9142674ffefd0973566371a9dca5

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Assetify do

  it "shoud read_jsfile" do
    mock_jsfile
    Assetify.read_jsfile.should have(1).asset
  end

  it "should skip comments" do
    mock_jsfile("#\n# Oi\n#\n")
    Assetify.read_jsfile.should be_nil
  end

  it "should work with versions url" do
    mock_jsfile("#\n# Oi\n#\njs 'down', 'http://js.com/down-{VERSION}.js', '1.6'")
    Assetify.read_jsfile.first.url.should eql("http://js.com/down-1.6.js")
  end

  describe "read css" do
    before do
      mock_jsfile("#\n# CSS\n#\ncss 'grid', 'http://grid.com/down'")
    end
    let(:asset) { Assetify.read_jsfile[0] }

    it "should read css" do
      Assetify.read_jsfile.should have(1).asset
    end

    it "should read css" do
      Assetify.read_jsfile.first.type.should eql(:css)
    end

    it "should have fullpath" do
      asset.fullpath.should eql("vendor/assets/stylesheets/grid.css")
    end

  end

  describe "readjs" do

    let(:asset) { mock_jsfile; Assetify.read_jsfile[0] }

    it "should be an asset" do
      asset.should be_an Assetify::Asset
    end

    it "should be a js file" do
      asset.type.should eql(:js)
    end

    it "should have an url" do
      asset.url.should eql("http://cool.js/down")
    end

    it "should have a name" do
      asset.name.should eql("cool")
    end

    it "should have fullpath" do
      asset.fullpath.should eql("vendor/assets/javascripts/cool.js")
    end


  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assetify-1.0.0.rc1 spec/assetify_spec.rb
assetify-0.7.0.rc1 spec/assetify_spec.rb