From 6eff04499e28865890e1ae3915fe80e4903a997b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 31 Mar 2011 12:25:04 -0700 Subject: Add using Turn with natural language test case names if the library is available (which it will be in Rails 3.1) [DHH] --- .../lib/active_support/testing/turn_formatting.rb | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 activesupport/lib/active_support/testing/turn_formatting.rb (limited to 'activesupport/lib/active_support/testing/turn_formatting.rb') diff --git a/activesupport/lib/active_support/testing/turn_formatting.rb b/activesupport/lib/active_support/testing/turn_formatting.rb new file mode 100644 index 0000000000..ed9381e298 --- /dev/null +++ b/activesupport/lib/active_support/testing/turn_formatting.rb @@ -0,0 +1,33 @@ +# Turn gives you prettier formatting for MiniTest and inline failure reporting. +# It also allows us to report test cases in natural language rather than with underscores. Example: +# +# CommentsControllerTest: +# PASS the truth (0.03s) +# +# APITest +# test_api_without_subdomain PASS +# test_create_milestone_using_typed_xml FAIL +# /test/integration/api_test.rb:50:in `test_create_milestone_using_typed_xml' +# <2006-05-01> expected but was +# . +# test_create_milestone_using_untyped_xml FAIL +# /test/integration/api_test.rb:38:in `test_create_milestone_using_untyped_xml' +# <2006-05-01> expected but was +# . + +# +# vs: +# +# .FF + +if defined?(MiniTest) + begin + silence_warnings { require 'turn' } + + if MiniTest::Unit.respond_to?(:use_natural_language_case_names=) + MiniTest::Unit.use_natural_language_case_names = true + end + rescue LoadError + # If there's no turn, that's fine, it's just formatting + end +end \ No newline at end of file -- cgit v1.2.3