strip .css from file names w/ test

This commit is contained in:
Scott Davis 2012-01-28 20:56:56 -05:00
parent 7b263fab5c
commit 7d87a2eee8
2 changed files with 12 additions and 1 deletions

View File

@ -36,7 +36,7 @@ module Compass
def stylesheet_name(sass_file)
if sass_file.index(from) == 0
sass_file[(from.length + 1)..-6]
sass_file[(from.length + 1)..-6].sub(/\.css$/,'')
else
raise Compass::Error, "You must compile individual stylesheets from the project directory."
end

View File

@ -0,0 +1,11 @@
require 'test_helper'
require 'fileutils'
class CompilerTest < Test::Unit::TestCase
it "should strip css from file name and reappend" do
compiler = Compass::Compiler.new(Dir.pwd, 'foo', 'bar', {})
assert_equal 'screen', compiler.stylesheet_name(File.join(Dir.pwd, 'foo', 'screen.css.scss'))
end
end