Sha256: 901fe45d16f2115e155d4a65602184c5fb5390842b37712c6b8551d604d219f1

Contents?: true

Size: 1.97 KB

Versions: 3

Compression:

Stored size: 1.97 KB

Contents

# encoding: utf-8

require 'spec_helper'
require 'classy_assets'

describe ClassyAssets::Configuration do
  subject { ClassyAssets::Configuration }
  it "returns an array of asset directories" do
    subject.asset_dirs.must_equal %w(fonts images javascripts stylesheets)
  end
  
  it "returns the asset digest setting" do
    subject.asset_digest.must_equal false 
  end

  it "returns the asset host" do
    subject.asset_host.must_equal nil
  end

  it "returns the asset prefix" do
    subject.asset_prefix.must_equal 'assets'
  end

  it "returns the css compressor setting" do
    subject.css_compressor.must_equal :yui 
  end

  it "returns the debug mode setting" do
    subject.debug_mode.must_equal false
  end
  
  it "returns the js compressor setting" do
    subject.js_compressor.must_equal :uglifier 
  end

  it "returns the path to the public folder" do
    subject.public_path.must_equal './public' 
  end
  
  it "returns the path to the root folder" do
    subject.root_path.must_equal '.' 
  end

  it "returns the sprockets environment" do
    subject.sprockets.must_be_kind_of Sprockets::Environment
  end

  it "returns the correct asset paths" do
    paths = subject.asset_dirs.map do |dir|
      File.join(subject.root_path, subject.asset_prefix, dir)
    end
    subject.sprockets.paths.must_equal paths
  end

  describe "configure" do
    before do
      @root_path = File.expand_path('../../support', __FILE__)
      @public_path = File.join(@root_path, 'public')

      ClassyAssets::Configuration.configure do |config|
        config.root_path = @root_path
        config.public_path = @public_path
      end
    end

    it "returns the configured root_path" do
      ClassyAssets::Configuration.root_path.must_equal @root_path
    end

    it "returns the configured public_path" do
      ClassyAssets::Configuration.public_path.must_equal @public_path
    end
  end

  after do
    ClassyAssets::Configuration.root_path = nil
    ClassyAssets::Configuration.public_path = nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
classy_assets-0.1.0 spec/classy_assets_spec.rb
classy_assets-0.0.5 spec/classy_assets_spec.rb
classy_assets-0.0.4 spec/classy_assets_spec.rb