Permalink
Browse files

add spec that up-to-date files will not be overwritten

  • Loading branch information...
1 parent 016aeb5 commit 01b1cffc04693b8e7a61ab8dffc337399a7b233a @grosser grosser committed Feb 13, 2010
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/more_test.rb
View
@@ -88,6 +88,7 @@ def assert_not_include(item, obj)
setup do
Less::More.source_path = 'less_files'
Less::More.destination_path = 'css'
+ Less::More.header = false
`mkdir -p #{css_path}`
end
@@ -96,6 +97,12 @@ def assert_not_include(item, obj)
`rm -rf #{less_path}`
end
+ should 'generate css from .less files' do
+ write_less 'test.less', "a{color:red}"
+ Less::More.generate_all
+ assert_include 'a { color: red; }', read_css('test.css')
+ end
+
should 'generate css from .lss files' do
write_less 'test.lss', "a{color:red}"
Less::More.generate_all
@@ -151,6 +158,26 @@ def assert_not_include(item, obj)
end
assert_include '/test.less', content
end
+
+ context 'mtime' do
+ should "generate for outdated less files" do
+ write_less 'test.less', "a{color:red}"
+ Less::More.generate_all
+ write_css 'test.css', 'im updated!'
+ sleep 1 # or mtime will be still the same ...
+ write_less 'test.less', "a{color:blue}"
+ Less::More.generate_all
+ assert_equal 'a { color: blue; }', read_css('test.css').strip
+ end
+
+ should "not generate for up-to-date less files" do
+ write_less 'test.less', "a{color:red}"
+ Less::More.generate_all
+ write_css 'test.css', 'im updated!'
+ Less::More.generate_all
+ assert_equal 'im updated!', read_css('test.css')
+ end
+ end
end
context :remove_all_generated do

0 comments on commit 01b1cff

Please sign in to comment.