# encoding: utf-8 require 'spec_helper' require 'classy_assets' describe ClassyAssets::Configuration do subject { ClassyAssets::Configuration } after do ClassyAssets::Configuration.root_path = nil ClassyAssets::Configuration.public_path = nil ClassyAssets::Configuration.sprockets.clear_paths end it "returns an array of asset directories" do paths = %w(fonts images javascripts stylesheets) paths.map! { |dir_name| File.join(ClassyAssets::Configuration.root_path, ClassyAssets::Configuration.asset_prefix, dir_name) } subject.asset_paths.must_equal paths 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 subject.sprockets.paths.must_equal subject.asset_paths.map {|p| File.expand_path(p) } 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 end