aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/test_case.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-09-16 16:50:14 +0200
committerMichael Koziarski <michael@koziarski.com>2008-09-16 16:50:14 +0200
commit4dae3649f062137347bac43cd0708207d2a94d66 (patch)
tree926334c745ec0e47daa1f69dad2434791105605a /activesupport/lib/active_support/test_case.rb
parentdc8bf7515de85f5bc28d17e96edf4a3e74a858da (diff)
downloadrails-4dae3649f062137347bac43cd0708207d2a94d66.tar.gz
rails-4dae3649f062137347bac43cd0708207d2a94d66.tar.bz2
rails-4dae3649f062137347bac43cd0708207d2a94d66.zip
Enhance the test "some string" method to support creating 'pending' tests.
If no block is provided to the test method, a default test will be generated which simply flunks. This makes it easy for you to generate a list of what you intend to do, then flesh it out with actual tests.
Diffstat (limited to 'activesupport/lib/active_support/test_case.rb')
-rw-r--r--activesupport/lib/active_support/test_case.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 0f531b0c79..197e73b3e8 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -12,7 +12,13 @@ module ActiveSupport
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
defined = instance_method(test_name) rescue false
raise "#{test_name} is already defined in #{self}" if defined
- define_method(test_name, &block)
+ if block_given?
+ define_method(test_name, &block)
+ else
+ define_method(test_name) do
+ flunk "No implementation provided for #{name}"
+ end
+ end
end
end
end