Permalink
Browse files

make tests more readable

  • Loading branch information...
1 parent b66becb commit f9acaf058c4e5abe939fd332cfde855cbc0579f8 @grosser grosser committed Feb 13, 2010
Showing with 19 additions and 18 deletions.
  1. +18 −18 test/more_test.rb
  2. +1 −0 test/test_helper.rb
View
@@ -1,12 +1,16 @@
require 'test_helper'
-class MoreTest < Test::Unit::TestCase
+class MoreTest < ActiveSupport::TestCase
def setup
[:compression, :header, :destination_path, :source_path].each do |variable|
Less::More.send("#{variable}=", nil)
end
end
+ def teardown
+ `rm -rf #{css_path}`
+ end
+
def prepare_for_generate
Less::More.source_path = 'less_files'
Less::More.destination_path = 'css'
@@ -19,47 +23,43 @@ def css_path
"#{Rails.root}/public/css"
end
- def teardown
- `rm -rf #{css_path}`
- end
-
- def test_default_for_header
+ test "header is true by default" do
assert_equal Less::More.header, true
end
- def test_header_can_be_overwritten
+ test "header can be overwritten" do
Less::More.header = false
assert_equal false, Less::More.header
end
- def test_default_for_source_path
+ test "source_path is app/stylesheets by default" do
assert_equal 'app/stylesheets', Less::More.source_path
end
- def test_source_path_can_be_overwritten
+ test "source_path can be overwritten" do
Less::More.source_path = 'xxx'
assert_equal 'xxx', Less::More.source_path
end
- def test_default_for_destination_path
+ test "destination_path is public/stylesheets by default" do
assert_equal 'stylesheets', Less::More.destination_path
end
- def test_destination_path_can_be_overwritten
+ test "destination_path can be overwritten" do
Less::More.destination_path = 'xxx'
assert_equal 'xxx', Less::More.destination_path
end
- def test_default_for_compression
+ test "compression is off by default" do
assert_equal nil, Less::More.compression
end
- def test_compression_can_be_overwritten
+ test "compression can be overwritten" do
Less::More.compression = true
assert_equal true, Less::More.compression
end
- def test_generate_with_partials
+ test "generate includes imported partials" do
prepare_for_generate
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
@@ -71,30 +71,30 @@ def test_generate_with_partials
}")
end
- def test_generate_does_not_parse_css
+ test "generate does not parse css" do
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
+ test "generate adds disclaimer-header when active" do
prepare_for_generate
Less::More.header = true
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
assert_match /^\/\*/, css # starts with comment -> header
end
- def test_generate_uses_no_header_when_not_set
+ test "generate uses no header when not set" do
prepare_for_generate
Less::More.header = false
Less::More.generate_all
css = File.read(File.join(css_path, 'test.css'))
assert_match /^\.allforms/, css
end
- def test_generate_does_not_generate_partials
+ test "generate does not generate partials" do
prepare_for_generate
Less::More.generate_all
assert !File.exist?(File.join(css_path, '_global.css'))
View
@@ -2,6 +2,7 @@
require 'rubygems'
require 'active_support'
+require 'active_support/test_case'
class Rails
def self.root

0 comments on commit f9acaf0

Please sign in to comment.