Skip to content
Browse files

Merge branch 'grosser/gallery' into develop

Conflicts:
	test/test_helper.rb
  • Loading branch information...
2 parents e96a46a + b426509 commit da4b5a50d70628ae4ffc713b98727867276d9775 Alexander Kern committed
View
3 .gitignore
@@ -3,6 +3,7 @@ rdoc
pkg
test/tmp
test/version_tmp
+test/reports
tmp
pkg
*.gem
@@ -19,4 +20,4 @@ _yardoc
doc/
# Gem-specific
-Gemfile.lock
+Gemfile.lock
View
32 Rakefile
@@ -1,10 +1,36 @@
require "bundler/gem_tasks"
+require "rake/testtask"
task :default => :test
-
-require "rake/testtask"
Rake::TestTask.new do |t|
t.libs << "test"
- t.pattern = "test/**/*_test.rb"
+ t.pattern = "test/unit/**/*_test.rb"
t.verbose = true
end
+
+Rake::TestTask.new("test:gallery") do |t|
+ t.libs << "test"
+ t.pattern = "test/gallery/**/*_test.rb"
+ t.verbose = true
+end
+
+# The RubyMine reporter must be tested separately inside of RubyMine, and hence
+# is not run in the gallery. The JUnit reporter writes to `test/reports` instead
+# of having meaningful output. The guard reporter requires Guard, and I'm not
+# really all that intersted in setting it up for automated testing for such a
+# simple reporter.
+task :gallery do
+ [
+ "DefaultReporter",
+ "JUnitReporter",
+ "ProgressReporter",
+ "RubyMateReporter",
+ "SpecReporter"
+ ].each do |reporter|
+ puts "Running gallery tests using #{reporter}..."
+ sh "rake test:gallery REPORTER=#{reporter}" do
+ # Ignore failures. They're expected when you are running the gallery
+ # test suite.
+ end
+ end
+end
View
25 test/gallery/bad_test.rb
@@ -0,0 +1,25 @@
+require "test_helper"
+
+module MiniTestReportersTest
+ class BadTest < TestCase
+ def test_a
+ assert_equal 1, 2
+ end
+
+ def test_b
+ assert false # simple failure
+ end
+
+ def test_b
+ assert_equal "ab\nc", "ab\nd" # some nice diff
+ end
+
+ def test_boom
+ raise "A random exception"
+ end
+
+ def test_long_method_name
+ skip
+ end
+ end
+end
View
14 test/gallery/good_test.rb
@@ -0,0 +1,14 @@
+require "test_helper"
+
+module MiniTestReportersTest
+ class GoodTest < TestCase
+ def test_a
+ assert_equal 1, 1
+ assert 1
+ end
+
+ def test_b
+ assert_equal 2, 2
+ end
+ end
+end
View
27 test/test_helper.rb
@@ -1,7 +1,7 @@
-require 'bundler/setup'
-require 'minitest/autorun'
-require 'rr'
-require 'minitest/reporters'
+require "bundler/setup"
+require "minitest/autorun"
+require "rr"
+require "minitest/reporters"
module MiniTestReportersTest
class TestCase < MiniTest::Unit::TestCase
@@ -10,15 +10,12 @@ class TestCase < MiniTest::Unit::TestCase
end
# Testing the built-in reporters using automated unit testing would be extremely
-# brittle. Consequently, there are no unit tests for them. Instead, uncomment
-# the reporter that you'd like to test and run the full test suite. Make sure to
-# try them with skipped, failing, and error tests as well!
+# brittle. Consequently, there are no unit tests for them. If you'd like to run
+# all the reporters sequentially on a fake test suite, run `rake gallery`.
-MiniTest::Reporters.use!
-# MiniTest::Reporters.use! MiniTest::Reporters::DefaultReporter.new
-# MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
-# MiniTest::Reporters.use! MiniTest::Reporters::ProgressReporter.new(:detailed_skip => false)
-# MiniTest::Reporters.use! MiniTest::Reporters::RubyMateReporter.new
-# MiniTest::Reporters.use! MiniTest::Reporters::RubyMineReporter.new
-# MiniTest::Reporters.use! MiniTest::Reporters::GuardReporter.new
-# MiniTest::Reporters.use! MiniTest::Reporters::JUnitReporter.new
+if ENV["REPORTER"]
+ reporter_klass = MiniTest::Reporters.const_get(ENV["REPORTER"])
+ MiniTest::Reporters.use! [reporter_klass.new]
+else
+ MiniTest::Reporters.use!
+end
View
0 test/minitest/backtrace_filter_test.rb → test/unit/minitest/backtrace_filter_test.rb
File renamed without changes.
View
0 test/minitest/reporter_test.rb → test/unit/minitest/reporter_test.rb
File renamed without changes.
View
0 test/minitest/reporters_test.rb → test/unit/minitest/reporters_test.rb
File renamed without changes.

0 comments on commit da4b5a5

Please sign in to comment.
Something went wrong with that request. Please try again.