From 4913984122c436a74179e6d0aa4b5ec0ca2ebe59 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 17 Nov 2012 14:21:09 -0200 Subject: [PATCH 1/2] Revert "Merge pull request #4575 from carlosantoniodasilva/remove-test-pending" This reverts commit 1620df78dff527b4fa3f7b204fa05d1b630aae17, reversing changes made to 2d000328dfc0d4b297fb4bdcebc9af6c2fb559dc. Conflicts: activesupport/CHANGELOG.md activesupport/lib/active_support/test_case.rb --- activesupport/CHANGELOG.md | 2 -- activesupport/lib/active_support/test_case.rb | 2 ++ .../lib/active_support/testing/pending.rb | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 activesupport/lib/active_support/testing/pending.rb diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index b55a706b2ff3c..fe1ffc82e5fc9 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -270,8 +270,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 c96ad17aba804..ee7bda9f93314 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/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 @@ def self.test_order # :nodoc: 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 0000000000000..510f80f32c8d9 --- /dev/null +++ b/activesupport/lib/active_support/testing/pending.rb @@ -0,0 +1,20 @@ +# Some code from jeremymcanally's "pending" +# https://github.com/jeremymcanally/pending/tree/master + +module ActiveSupport + module Testing + module Pending + + unless defined?(Spec) + + @@pending_cases = [] + @@at_exit = false + + def pending(description = "", &block) + skip(description.blank? ? nil : description) + end + end + + end + end +end From 92da512125fb5aeb7d7418c80cdd0ead5aaf30bb Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 17 Nov 2012 14:24:33 -0200 Subject: [PATCH 2/2] Properly deprecate #pending from AS::TestCase Check https://github.com/rails/rails/pull/4575#issuecomment-5765575. --- activesupport/CHANGELOG.md | 2 ++ activesupport/lib/active_support/testing/pending.rb | 10 ++-------- activesupport/test/test_case_test.rb | 6 ++++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index fe1ffc82e5fc9..504ebcb2fe959 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 diff --git a/activesupport/lib/active_support/testing/pending.rb b/activesupport/lib/active_support/testing/pending.rb index 510f80f32c8d9..944806bb64d17 100644 --- a/activesupport/lib/active_support/testing/pending.rb +++ b/activesupport/lib/active_support/testing/pending.rb @@ -1,20 +1,14 @@ -# Some code from jeremymcanally's "pending" -# https://github.com/jeremymcanally/pending/tree/master +require 'active_support/deprecation' module ActiveSupport module Testing module Pending - unless defined?(Spec) - - @@pending_cases = [] - @@at_exit = false - 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 64426d02e9f56..dfe9f3c11cf9b 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -108,5 +108,11 @@ def test_true; assert true end 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