1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] [SCSS] Fix some failing plugin tests.

This commit is contained in:
Nathan Weizenbaum 2009-12-22 09:55:18 -08:00
parent 82b9b10431
commit d1e14d1d7d
2 changed files with 20 additions and 10 deletions

View file

@ -140,7 +140,7 @@ module Sass
end
def stylesheet_needs_update?(css_file, template_file)
return true unless File.exists?(css_file)
return true unless File.exists?(css_file) && File.exists?(template_file)
css_mtime = File.mtime(css_file)
File.mtime(template_file) > css_mtime ||

View file

@ -30,25 +30,25 @@ class SassPluginTest < Test::Unit::TestCase
def test_no_update
File.delete(tempfile_loc('basic'))
assert Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_needs_update 'basic'
Sass::Plugin.update_stylesheets
assert !Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_doesnt_need_update 'basic'
end
def test_update_needed_when_modified
sleep 1
FileUtils.touch(template_loc('basic'))
assert Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_needs_update 'basic'
Sass::Plugin.update_stylesheets
assert !Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_doesnt_need_update 'basic'
end
def test_update_needed_when_dependency_modified
sleep 1
FileUtils.touch(template_loc('basic'))
assert Sass::Plugin.stylesheet_needs_update?('import', template_loc, tempfile_loc)
assert_needs_update 'import'
Sass::Plugin.update_stylesheets
assert !Sass::Plugin.stylesheet_needs_update?('import', template_loc, tempfile_loc)
assert_doesnt_need_update 'import'
end
def test_full_exception_handling
@ -116,7 +116,7 @@ CSS
set_plugin_opts
File.delete(tempfile_loc('basic'))
assert Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_needs_update 'basic'
if defined?(MerbHandler)
MerbHandler.new('.').process nil, nil
@ -124,7 +124,7 @@ CSS
Merb::Rack::Application.new.call(::Rack::MockRequest.env_for('/'))
end
assert !Sass::Plugin.stylesheet_needs_update?('basic', template_loc, tempfile_loc)
assert_doesnt_need_update 'basic'
end
def test_doesnt_render_partials
@ -139,7 +139,7 @@ CSS
sleep 1
FileUtils.touch(template_loc("basic", "more_"))
assert Sass::Plugin.stylesheet_needs_update?("import", template_loc, tempfile_loc)
assert_needs_update "basic"
Sass::Plugin.update_stylesheets
assert_renders_correctly("import")
ensure
@ -211,6 +211,16 @@ CSS
time = Time.now
loop {break if Time.now.sec != time.sec}
end
def assert_needs_update(template)
assert Sass::Plugin.stylesheet_needs_update?(
tempfile_loc(template), template_loc(template))
end
def assert_doesnt_need_update(template)
assert !Sass::Plugin.stylesheet_needs_update?(
tempfile_loc(template), template_loc(template))
end
end
module Sass::Plugin