Testing Sass' exception handling.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@243 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
65d95f907a
commit
8a505a26a9
|
@ -34,7 +34,21 @@ class SassPluginTest < Test::Unit::TestCase
|
|||
assert !Sass::Plugin.stylesheet_needs_update?('basic')
|
||||
end
|
||||
|
||||
def assert(*args)
|
||||
def test_exception_handling
|
||||
File.open(tempfile_loc('bork')) do |file|
|
||||
assert file.gets == "bork bork bork!\n"
|
||||
end
|
||||
File.delete(tempfile_loc('bork'))
|
||||
Sass.const_set('RAILS_ENV', 'production')
|
||||
raised = false
|
||||
begin
|
||||
Sass::Plugin.update_stylesheets
|
||||
rescue
|
||||
raised = true
|
||||
end
|
||||
assert raised
|
||||
assert !File.exists?(tempfile_loc('bork'))
|
||||
Sass::Plugin.const_set('RAILS_ENV', 'testing')
|
||||
end
|
||||
|
||||
def test_controller_process
|
||||
|
@ -70,6 +84,15 @@ module Sass::Plugin
|
|||
end
|
||||
end
|
||||
|
||||
class Sass::Engine
|
||||
alias_method :old_render, :render
|
||||
|
||||
def render
|
||||
raise "bork bork bork!" if @template[0] == "{bork now!}"
|
||||
old_render
|
||||
end
|
||||
end
|
||||
|
||||
class ActionController::Base
|
||||
def sass_old_process(*args); end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
{bork now!}
|
||||
This template isn't actually Sass. It's designed to make the interpreter choke, to test the exception-handling code.
|
Loading…
Reference in New Issue