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})" formatted_error = "(Line #{e.sass_line}: #{e.message})"
file = basename(sass_filename) file = basename(sass_filename)
logger.record :error, file, formatted_error 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) write_file css_filename, error_contents(e, sass_filename), options.merge(:force => true)
end end

View File

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