Class Test::Unit::TestCase
In: vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
Parent: Object

This extension of the standard Test::Unit::TestCase makes RSpec available from within, so that you can do things like:

require ‘test/unit’ require ‘spec‘

class MyTest < Test::Unit::TestCase

  it "should work with Test::Unit assertions" do
    assert_equal 4, 2+1
  end

  def test_should_work_with_rspec_expectations
    (3+1).should == 5
  end

end

See also Spec::Example::ExampleGroup

Methods

example_method?   new   run   suite   test_method?  

Included Modules

Spec::Example::ExampleMethods

Public Class methods

[Source]

    # File vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb, line 34
34:         def example_method?(method_name)
35:           should_method?(method_name) || test_method?(method_name)
36:         end

[Source]

    # File vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb, line 46
46:       def initialize(defined_description, &implementation)
47:         @_defined_description = defined_description
48:         @_implementation = implementation
49: 
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
54:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb, line 30
30:         def suite
31:           Test::Unit::TestSuiteAdapter.new(self)
32:         end

[Source]

    # File vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb, line 38
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
42:           )
43:         end

Public Instance methods

[Source]

    # File vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb, line 56
56:       def run(ignore_this_argument=nil)
57:         super()
58:       end

[Validate]