Sha256: 762ecd6014a36798187fbf4c049c28d49c1834b7ab9293b0e3075f33fcc92af8

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Rails2AssetPipeline do
  it "has a VERSION" do
    Rails2AssetPipeline::VERSION.should =~ /^[\.\da-z]+$/
  end

  describe ".env" do
    before do
      Rails2AssetPipeline.instance_variable_set :@env, nil
    end

    it "sets itself" do
      Rails2AssetPipeline.env.should_not == nil
    end

    it "stays the same" do
      Rails2AssetPipeline.env.object_id.should == Rails2AssetPipeline.env.object_id
    end
  end

  describe ".setup" do
    it "yields the sprocket env" do
      result = nil
      Rails2AssetPipeline.setup{|x| result = x }
      result.class.should == Sprockets::Environment
    end

    it "does not recreate the sprockets env" do
      a,b = nil
      Rails2AssetPipeline.setup{|x| a = x }
      Rails2AssetPipeline.setup{|x| b = x }
      a.object_id.should == b.object_id
    end
  end

  describe ".config_ru" do
    def map(*args)
      @mapped = args
    end

    it "sets up a route for development" do
      Rails.env = "development"
      instance_exec(&Rails2AssetPipeline.config_ru)
      @mapped.should == ["/assets"]
    end

    it "does not set up a route for production" do
      Rails.env = "production"
      instance_exec(&Rails2AssetPipeline.config_ru)
      @mapped.should == nil
    end
  end

  describe ".manifest" do
    it "can be set" do
      Rails2AssetPipeline.manifest = "xxx"
      Rails2AssetPipeline.manifest.should == "xxx"
    end

    it "is there" do
      Rails2AssetPipeline.manifest.should =~ %r{/spec/fake_rails/public/assets/manifest.json$}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails2_asset_pipeline-0.1.17 spec/rails2_asset_pipeline_spec.rb