1 require 'test/unit/testcase'
5 # This extension of the standard Test::Unit::TestCase makes RSpec
6 # available from within, so that you can do things like:
11 # class MyTest < Test::Unit::TestCase
12 # it "should work with Test::Unit assertions" do
16 # def test_should_work_with_rspec_expectations
21 # See also Spec::Example::ExampleGroup
23 extend Spec::Example::ExampleGroupMethods
24 include Spec::Example::ExampleMethods
27 after(:each) {teardown}
31 Test::Unit::TestSuiteAdapter.new(self)
34 def example_method?(method_name)
35 should_method?(method_name) || test_method?(method_name)
38 def test_method?(method_name)
39 method_name =~ /^test[_A-Z]./ && (
40 instance_method(method_name).arity == 0 ||
41 instance_method(method_name).arity == -1
46 def initialize(defined_description, &implementation)
47 @_defined_description = defined_description
48 @_implementation = implementation
50 @_result = ::Test::Unit::TestResult.new
51 # @method_name is important to set here because it "complies" with Test::Unit's interface.
52 # Some Test::Unit extensions depend on @method_name being present.
53 @method_name = @_defined_description
56 def run(ignore_this_argument=nil)