2009-02-13 07:08:57 +00:00
|
|
|
require File.dirname(__FILE__)+'/test_helper'
|
|
|
|
require 'compass'
|
|
|
|
|
|
|
|
class ConfigurationTest < Test::Unit::TestCase
|
2009-05-08 15:08:26 +00:00
|
|
|
|
2009-05-08 15:11:42 +00:00
|
|
|
def setup
|
|
|
|
Compass.configuration.reset!
|
|
|
|
end
|
|
|
|
|
2009-02-13 07:08:57 +00:00
|
|
|
def test_parse_and_serialize
|
|
|
|
contents = <<-CONFIG
|
|
|
|
require 'compass'
|
2009-02-21 01:11:22 +00:00
|
|
|
# Require any additional compass plugins here.
|
2009-02-13 07:08:57 +00:00
|
|
|
|
2009-05-08 15:08:26 +00:00
|
|
|
project_type = :stand_alone
|
2009-02-13 07:08:57 +00:00
|
|
|
css_dir = "css"
|
|
|
|
sass_dir = "sass"
|
|
|
|
images_dir = "img"
|
|
|
|
javascripts_dir = "js"
|
2009-05-08 15:08:26 +00:00
|
|
|
output_style = :nested
|
2009-04-07 06:56:29 +00:00
|
|
|
# To enable relative image paths using the images_url() function:
|
|
|
|
# http_images_path = :relative
|
2009-05-08 15:08:26 +00:00
|
|
|
http_images_path = "/images"
|
2009-02-13 07:08:57 +00:00
|
|
|
CONFIG
|
|
|
|
|
|
|
|
Compass.configuration.parse_string(contents, "test_parse")
|
|
|
|
|
|
|
|
assert_equal 'sass', Compass.configuration.sass_dir
|
|
|
|
assert_equal 'css', Compass.configuration.css_dir
|
|
|
|
assert_equal 'img', Compass.configuration.images_dir
|
|
|
|
assert_equal 'js', Compass.configuration.javascripts_dir
|
|
|
|
|
|
|
|
expected_lines = contents.split("\n").map{|l|l.strip}
|
|
|
|
actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip}
|
|
|
|
assert_equal expected_lines, actual_lines
|
|
|
|
end
|
|
|
|
|
2009-06-27 18:28:16 +00:00
|
|
|
def test_serialization_fails_with_asset_host_set
|
|
|
|
contents = <<-CONFIG
|
|
|
|
asset_host do |path|
|
|
|
|
"http://example.com"
|
|
|
|
end
|
|
|
|
CONFIG
|
|
|
|
|
|
|
|
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set")
|
|
|
|
|
|
|
|
assert_raise Compass::Error do
|
|
|
|
Compass.configuration.serialize
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_serialization_fails_with_asset_cache_buster_set
|
|
|
|
contents = <<-CONFIG
|
|
|
|
asset_cache_buster do |path|
|
|
|
|
"http://example.com"
|
|
|
|
end
|
|
|
|
CONFIG
|
|
|
|
|
|
|
|
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set")
|
|
|
|
|
|
|
|
assert_raise Compass::Error do
|
|
|
|
Compass.configuration.serialize
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-02-13 07:08:57 +00:00
|
|
|
end
|