added failing test for issue #400 and fixed the callback typo closes #400

This commit is contained in:
Scott Davis 2011-05-25 11:44:13 -04:00
parent 9992a18a72
commit faba01f34c
2 changed files with 11 additions and 9 deletions

View File

@ -153,7 +153,7 @@ module Compass
formatted_error = "(Line #{e.sass_line}: #{e.message})"
file = basename(sass_filename)
logger.record :error, file, formatted_error
Compass.configuration.run_callback(:styesheet_error, sass_filename, formatted_error)
Compass.configuration.run_callback(:stylesheet_error, sass_filename, formatted_error)
write_file css_filename, error_contents(e, sass_filename), options.merge(:force => true)
end

View File

@ -30,14 +30,16 @@ class CompassTest < Test::Unit::TestCase
# no project with errors exists to test aginst - leep of FAITH!
# *chriseppstein flogs himself*
# def test_on_stylesheet_error_callback
# error = false
# file = nil
# Compass.configuration.on_stylesheet_error {|filename, message| file = filename; error = true }
# within_project(:error) { } #requires a block but we don't need to pass anything - sdavis
# assert error, "Project did not throw a compile error"
# assert file.is_a?(String), "Filename was not a string"
# end
def test_on_stylesheet_error_callback
error = false
file = nil
before_compile = Proc.new do |config|
config.on_stylesheet_error {|filename, message| file = filename; error = true }
end
within_project(:error, before_compile) rescue nil;
assert error, "Project did not throw a compile error"
assert file.is_a?(String), "Filename was not a string"
end
def test_empty_project
# With no sass files, we should have no css files.