confirm port is an integer
[github-services.git] / vendor / activesupport-2.2.2 / lib / active_support / test_case.rb
blob197e73b3e85ec9195d8d3a16f9a84d5c84cf73e9
1 require 'test/unit/testcase'
2 require 'active_support/testing/default'
3 require 'active_support/testing/core_ext/test'
6 module ActiveSupport
7   class TestCase < Test::Unit::TestCase
8     # test "verify something" do
9     #   ...
10     # end
11     def self.test(name, &block)
12       test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
13       defined = instance_method(test_name) rescue false
14       raise "#{test_name} is already defined in #{self}" if defined
15       if block_given?
16         define_method(test_name, &block)
17       else
18         define_method(test_name) do
19           flunk "No implementation provided for #{name}"
20         end
21       end
22     end
23   end
24 end