diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-18 21:34:32 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-18 21:34:32 -0200 |
commit | e21579f1d11983ab3296e530afafd836d6e29b1f (patch) | |
tree | b1f7741ec097c58ae2dfa8ca8c06d6252fec0562 | |
parent | a739340d3c9e66814429af6f3f410c01ff86810a (diff) | |
parent | 92da512125fb5aeb7d7418c80cdd0ead5aaf30bb (diff) | |
download | rails-e21579f1d11983ab3296e530afafd836d6e29b1f.tar.gz rails-e21579f1d11983ab3296e530afafd836d6e29b1f.tar.bz2 rails-e21579f1d11983ab3296e530afafd836d6e29b1f.zip |
Merge branch 'deprecate-pending'
Properly deprecate #pending from AS::TestCase. This has been previously
removed from master, and is now back with a deprecation instead, to avoid
people having tests breaking when upgrading an app.
Please check #4575 for more background.
-rw-r--r-- | activesupport/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/test_case.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/pending.rb | 14 | ||||
-rw-r--r-- | activesupport/test/test_case_test.rb | 6 |
4 files changed, 24 insertions, 2 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index b55a706b2f..504ebcb2fe 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,7 @@ ## Rails 4.0.0 (unreleased) ## +* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead. *Carlos Antonio da Silva* + * `XmlMini.with_backend` now may be safely used with threads: Thread.new do @@ -270,8 +272,6 @@ * Add html_escape_once to ERB::Util, and delegate escape_once tag helper to it. *Carlos Antonio da Silva* -* Remove ActiveSupport::TestCase#pending method, use `skip` instead. *Carlos Antonio da Silva* - * Deprecates the compatibility method Module#local_constant_names, use Module#local_constants instead (which returns symbols). *fxn* diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index c96ad17aba..ee7bda9f93 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -4,6 +4,7 @@ require 'active_support/testing/tagged_logging' require 'active_support/testing/setup_and_teardown' require 'active_support/testing/assertions' require 'active_support/testing/deprecation' +require 'active_support/testing/pending' require 'active_support/testing/isolation' require 'active_support/testing/constant_lookup' require 'active_support/core_ext/kernel/reporting' @@ -40,6 +41,7 @@ module ActiveSupport include ActiveSupport::Testing::SetupAndTeardown include ActiveSupport::Testing::Assertions include ActiveSupport::Testing::Deprecation + include ActiveSupport::Testing::Pending def self.describe(text) if block_given? diff --git a/activesupport/lib/active_support/testing/pending.rb b/activesupport/lib/active_support/testing/pending.rb new file mode 100644 index 0000000000..944806bb64 --- /dev/null +++ b/activesupport/lib/active_support/testing/pending.rb @@ -0,0 +1,14 @@ +require 'active_support/deprecation' + +module ActiveSupport + module Testing + module Pending + unless defined?(Spec) + def pending(description = "", &block) + ActiveSupport::Deprecation.warn("#pending is deprecated and will be removed in Rails 4.1, please use #skip instead.") + skip(description.blank? ? nil : description) + end + end + end + end +end diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 64426d02e9..dfe9f3c11c 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -108,5 +108,11 @@ module ActiveSupport test = tc.new test_name assert_raises(Interrupt) { test.run fr } end + + def test_pending_deprecation + assert_deprecated do + pending "should use #skip instead" + end + end end end |