Permalink
Browse files

updated the gem and test env; moving tests to assert framework

  • Loading branch information...
1 parent 886eba1 commit 54e59a204de4dd17bd621709979b2b5991046d07 @kellyredding committed Aug 26, 2011
Showing with 54 additions and 58 deletions.
  1. +0 −2 .bundle/config
  2. +5 −4 .gitignore
  3. +3 −3 Rakefile
  4. +3 −2 rack-less.gemspec
  5. +0 −9 test/env.rb
  6. +34 −38 test/helper.rb
  7. +9 −0 test/irb.rb
View
@@ -1,2 +0,0 @@
----
-BUNDLE_DISABLE_SHARED_GEMS: "1"
View
@@ -1,5 +1,6 @@
-/pkg/
-/doc/
-/coverage/
+pkg/*
+.bundle
+*.gem
*.log
-.DS_Store
+.rvmrc
+.rbenv-version
View
@@ -1,7 +1,7 @@
+require 'assert/rake_tasks'
+include Assert::RakeTasks
+
require 'bundler'
Bundler::GemHelper.install_tasks
-require 'test_belt/rake_tasks'
-TestBelt::RakeTasks.for :test
-
task :default => :build
View
@@ -10,15 +10,16 @@ Gem::Specification.new do |s|
s.email = ["kelly@kelredd.com"]
s.homepage = "http://github.com/kelredd/rack-less"
s.summary = %q{LESS CSS preprocessing for Rack apps.}
- s.description = %q{Use rack middleware to handle LESS CSS preprocessing. Processing happens on requests to LESS resources. This allows you to develop, check in, and deploy unprocessed LESS stylesheets and leave the processing to the middleware. Allows for optimizing by environment: never-cache, always-reprocess in development; cache, process-once in production (for example).}
+ s.description = %q{LESS CSS preprocessing for Rack apps.}
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.add_development_dependency("bundler", ["~> 1.0"])
- s.add_development_dependency("test-belt", ["= 0.2.1"]) # locked to a specific version for test stability
+ s.add_development_dependency("assert", ["~>0.3.0"])
+
s.add_development_dependency("sinatra", [">= 0.9.4"])
s.add_development_dependency("rack-test", [">= 0.5.3"])
s.add_development_dependency("webrat", [">= 0.6.0"])
View
@@ -1,9 +0,0 @@
-# Add test and lib paths to the $LOAD_PATH
-[ File.dirname(__FILE__),
- File.join(File.dirname(__FILE__), '..', 'lib')
-].each do |path|
- full_path = File.expand_path(path)
- $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
-end
-
-require 'rack/less'
View
@@ -1,29 +1,26 @@
-require 'rubygems'
-require 'bundler'
-Bundler.setup
+# this file is automatically required in when you require 'assert' in your tests
+# put test helpers here
-require 'test_belt'
-require 'test/env'
+# add root dir to the load path
+$LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
-class Test::Unit::TestCase
+class Assert::Context
def file_path(*segments)
segs = segments.unshift([File.dirname(__FILE__), '..']).flatten
File.expand_path(segs.join(File::SEPARATOR))
end
def self.should_compile_source(name, desc)
- context desc do
- setup do
- @compiled = File.read(File.join(@source_folder, "#{name}_compiled.css"))
- @source = Rack::Less::Source.new(name, :folder => @source_folder)
- end
+ setup do
+ @compiled = File.read(File.join(@source_folder, "#{name}_compiled.css"))
+ @source = Rack::Less::Source.new(name, :folder => @source_folder)
+ end
- should "compile LESS" do
- assert_equal @compiled.strip, @source.compiled.strip, '.compiled is incorrect'
- assert_equal @compiled.strip, @source.to_css.strip, '.to_css is incorrect'
- assert_equal @compiled.strip, @source.css.strip, '.css is incorrect'
- end
+ should "compile LESS" do
+ assert_equal @compiled.strip, @source.compiled.strip, '.compiled is incorrect'
+ assert_equal @compiled.strip, @source.to_css.strip, '.to_css is incorrect'
+ assert_equal @compiled.strip, @source.css.strip, '.css is incorrect'
end
end
@@ -45,33 +42,32 @@ def less_response(css)
end
def self.should_not_be_a_valid_rack_less_request(args)
- context "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})" do
- setup do
- @request = less_request(args[:method], args[:resource])
- end
+ desc "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})"
+ setup do
+ @request = less_request(args[:method], args[:resource])
+ end
- should "not be a valid endpoint for Rack::Less" do
- not_valid = !@request.get?
- not_valid ||= !@request.for_css?
- not_valid ||= @request.source.files.empty?
- assert not_valid, 'request is a GET for .css format and has source'
- assert !@request.for_less?, 'the request is for less'
- end
+ should "not be a valid endpoint for Rack::Less" do
+ not_valid = !@request.get?
+ not_valid ||= !@request.for_css?
+ not_valid ||= @request.source.files.empty?
+ assert not_valid, 'request is a GET for .css format and has source'
+ assert !@request.for_less?, 'the request is for less'
end
end
+
def self.should_be_a_valid_rack_less_request(args)
- context "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})" do
- setup do
- @request = less_request(args[:method], args[:resource])
- end
+ desc "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})"
+ setup do
+ @request = less_request(args[:method], args[:resource])
+ end
- should "be a valid endpoint for Rack::Less" do
- assert @request.get?, 'the request is not a GET'
- assert @request.for_css?, 'the request is not for css'
- assert !@request.source.files.empty?, 'the request resource has no source'
- assert @request.for_less?, 'the request is not for less'
- end
+ should "be a valid endpoint for Rack::Less" do
+ assert @request.get?, 'the request is not a GET'
+ assert @request.for_css?, 'the request is not for css'
+ assert !@request.source.files.empty?, 'the request resource has no source'
+ assert @request.for_less?, 'the request is not for less'
end
end
-end
+end
View
@@ -0,0 +1,9 @@
+require 'assert/setup'
+
+# this file is required in when the 'irb' rake test is run.
+# b/c 'assert/setup' is required above, the test helper will be
+# required in.
+
+# put any IRB setup code here
+
+require 'rack/less'

0 comments on commit 54e59a2

Please sign in to comment.