From 0eb6e5e270c0a1114fdafe4a8daa35ee88e176e3 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 31 Mar 2011 16:20:59 -0700 Subject: [PATCH] Moved Turn activation/dependency to railties --- activesupport/CHANGELOG | 2 -- activesupport/lib/active_support/test_case.rb | 1 - .../active_support/testing/turn_formatting.rb | 33 ------------------- rails.gemspec | 1 - railties/CHANGELOG | 2 ++ railties/lib/rails/commands/console.rb | 2 +- railties/lib/rails/test_help.rb | 8 +++++ railties/railties.gemspec | 1 + 8 files changed, 12 insertions(+), 38 deletions(-) delete mode 100644 activesupport/lib/active_support/testing/turn_formatting.rb diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 1be5f39ac4ae9..373236ce9a27a 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,7 +1,5 @@ *Rails 3.1.0 (unreleased)* -* Add using Turn with natural language test case names if the library is available (which it will be in Rails 3.1) [DHH] - * LocalCache strategy is now a real middleware class, not an anonymous class posing for pictures. diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 7ac9ad46e910f..8d6c27e381b97 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -5,7 +5,6 @@ require 'active_support/testing/declarative' require 'active_support/testing/pending' require 'active_support/testing/isolation' -require 'active_support/testing/turn_formatting' require 'active_support/testing/mochaing' require 'active_support/core_ext/kernel/reporting' diff --git a/activesupport/lib/active_support/testing/turn_formatting.rb b/activesupport/lib/active_support/testing/turn_formatting.rb deleted file mode 100644 index ed9381e29850c..0000000000000 --- a/activesupport/lib/active_support/testing/turn_formatting.rb +++ /dev/null @@ -1,33 +0,0 @@ -# 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 diff --git a/rails.gemspec b/rails.gemspec index 2711d95f3477a..98b5f46554546 100644 --- a/rails.gemspec +++ b/rails.gemspec @@ -25,6 +25,5 @@ Gem::Specification.new do |s| s.add_dependency('activeresource', version) s.add_dependency('actionmailer', version) s.add_dependency('railties', version) - s.add_dependency('turn', '~> 0.8.2') s.add_dependency('bundler', '~> 1.0') end diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 07e7e461de80c..f1592473082b8 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *Rails 3.1.0 (unreleased)* +* Add using Turn with natural language test case names for test_help.rb when running with minitest (Ruby 1.9.2+) [DHH] + * Direct logging of Active Record to STDOUT so it's shown inline with the results in the console [DHH] * Added `config.force_ssl` configuration which loads Rack::SSL middleware and force all requests to be under HTTPS protocol [DHH, Prem Sichanugrist, and Josh Peek] diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 2a6cdca440da7..2b7faf9715781 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -36,7 +36,7 @@ def start end if defined?(ActiveRecord) - ActiveRecord::Base.logger = Logger.new(STDOUT) + ActiveRecord::Base.logger = Logger.new(STDERR) end if options[:sandbox] diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 00029e627e32d..b9f7bdc2eb7cc 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -13,6 +13,14 @@ Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit } end +if defined?(MiniTest) + require 'turn' + + if MiniTest::Unit.respond_to?(:use_natural_language_case_names=) + MiniTest::Unit.use_natural_language_case_names = true + end +end + if defined?(ActiveRecord) require 'active_record/test_case' diff --git a/railties/railties.gemspec b/railties/railties.gemspec index c51fe856bea9f..1e233c885e8e2 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |s| s.add_dependency('rake', '>= 0.8.7') s.add_dependency('thor', '~> 0.14.4') s.add_dependency('rack-ssl', '~> 1.3.2') + s.add_dependency('turn', '~> 0.8.2') s.add_dependency('activesupport', version) s.add_dependency('actionpack', version) end