Skip to content

Commit

Permalink
Initial project.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Mar 27, 2012
0 parents commit 2f6f1b1
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source :rubygems
gemspec
22 changes: 22 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2011 Ken Collins, <[email protected]>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

= MiniTest::Spec For Rails

Make Test::Unit::TestCase a subclass of of MiniTest::Spec with this simple shim. Tricks ActiveSupport::TestCase to use MiniTest::Spec instead. Includes any monkey patches to make using MiniTest::Spec a drop in behavior change for any Rails 3 project. Full Details here:

http:https://metaskills.net/2011/03/26/using-minitest-spec-with-rails/


= Code

* http:https://github.com/metaskills/minitest-spec-rails




13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'bundler'
require 'rake/testtask'

Bundler::GemHelper.install_tasks

Rake::TestTask.new do |t|
t.libs = ['lib','test']
t.test_files = Dir.glob("test/**/*_test.rb").sort
t.verbose = true
end

task :default => [:test]

4 changes: 4 additions & 0 deletions lib/minitest-spec-rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'minitest/spec'
require 'test/unit/testcase'
require 'minitest-spec-rails/version'
require 'minitest-spec-rails/test_case'
3 changes: 3 additions & 0 deletions lib/minitest-spec-rails/test_case.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class << ActiveSupport::TestCase
remove_method :describe
end if defined?(ActiveSupport::TestCase)
3 changes: 3 additions & 0 deletions lib/minitest-spec-rails/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module MiniSpecUnit
VERSION = "0.4.0"
end
9 changes: 9 additions & 0 deletions lib/test/unit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'minitest/autorun'
require 'test/unit/assertions'
require 'test/unit/testcase'

module Test
module Unit

end
end
7 changes: 7 additions & 0 deletions lib/test/unit/assertions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'minitest/spec'

module Test
module Unit
Assertions = ::MiniTest::Assertions
end
end
23 changes: 23 additions & 0 deletions lib/test/unit/testcase.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'minitest/spec'
require 'test/unit/assertions'
require 'pp'

module Test
module Unit
class TestCase < ::MiniTest::Spec

MINI_SPECUNIT = true

def mu_pp(obj)
obj.pretty_inspect.chomp
end

def build_message(head, template=nil, *arguments)
template &&= template.chomp
template.gsub(/\?/) { mu_pp(arguments.shift) }
end

end

end
end
20 changes: 20 additions & 0 deletions minitest-spec-rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "minitest-spec-rails/version"

Gem::Specification.new do |s|
s.name = 'minitest-spec-rails'
s.version = MiniSpecUnit::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Ken Collins']
s.email = ['[email protected]']
s.homepage = 'http:https://github.com/metaskills/minitest-spec-rails'
s.summary = 'Make Test::Unit::TestCase a subclass of of MiniTest::Spec.'
s.description = 'Force ActiveSupport::TestCase to subclass MiniTest::Spec for a drop in behavior change.'
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_runtime_dependency 'minitest', '~> 2.11'
s.add_development_dependency 'rake'
end

0 comments on commit 2f6f1b1

Please sign in to comment.