Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplify tests

  • Loading branch information...
commit b66becbee0061d37f65c1b457fe42fefcccd7c6c 1 parent 7990548
@grosser grosser authored
Showing with 15 additions and 9 deletions.
  1. +15 −9 test/more_test.rb
View
24 test/more_test.rb
@@ -11,10 +11,16 @@ def prepare_for_generate
Less::More.source_path = 'less_files'
Less::More.destination_path = 'css'
- css = "#{Rails.root}/public/css"
- `rm -rf #{css}`
- `mkdir -p #{css}`
- css
+ `rm -rf #{css_path}`
+ `mkdir -p #{css_path}`
+ end
+
+ def css_path
+ "#{Rails.root}/public/css"
+ end
+
+ def teardown
+ `rm -rf #{css_path}`
end
def test_default_for_header
@@ -54,7 +60,7 @@ def test_compression_can_be_overwritten
end
def test_generate_with_partials
- css_path = prepare_for_generate
+ prepare_for_generate
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
assert css.include?(".allforms { font-size: 110%; }
@@ -66,14 +72,14 @@ def test_generate_with_partials
end
def test_generate_does_not_parse_css
- css_path = prepare_for_generate
+ prepare_for_generate
Less::More.generate_all
original_css = File.read(File.join(css_path, 'plain.css'))
assert_equal File.read(File.join(Rails.root,'less_files', 'plain.css')), original_css
end
def test_generate_uses_header_when_set
- css_path = prepare_for_generate
+ prepare_for_generate
Less::More.header = true
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
@@ -81,7 +87,7 @@ def test_generate_uses_header_when_set
end
def test_generate_uses_no_header_when_not_set
- css_path = prepare_for_generate
+ prepare_for_generate
Less::More.header = false
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
@@ -89,7 +95,7 @@ def test_generate_uses_no_header_when_not_set
end
def test_generate_does_not_generate_partials
- css_path = prepare_for_generate
+ prepare_for_generate
Less::More.generate_all
assert !File.exist?(File.join(css_path, '_global.css'))
end
Please sign in to comment.
Something went wrong with that request. Please try again.