Class Test::Unit::TestCase

  1. 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 ‘spec/test/unit‘

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

public class

  1. example_method?
  2. new
  3. suite
  4. test_method?

public instance

  1. run

Public class methods

example_method? (method_name)
[show source]
# File lib/spec/interop/test/unit/testcase.rb, line 29
      def self.example_method?(method_name)
        should_method?(method_name) || test_method?(method_name)
      end
new (description, options={}, &implementation)
[show source]
# File lib/spec/interop/test/unit/testcase.rb, line 43
      def initialize(description, options={}, &implementation)
        super
        # Some Test::Unit extensions depend on @method_name being present.
        @method_name = description
        @_result = ::Test::Unit::TestResult.new
      end
suite ()
[show source]
# File lib/spec/interop/test/unit/testcase.rb, line 25
      def self.suite
        Test::Unit::TestSuiteAdapter.new(self)
      end
test_method? (method_name)
[show source]
# File lib/spec/interop/test/unit/testcase.rb, line 33
      def self.test_method?(method_name)
        method_name =~ /^test[_A-Z]./ && (
          instance_method(method_name).arity == 0 ||
          instance_method(method_name).arity == -1
        )
      end

Public instance methods

run (ignore_this_argument=nil)
[show source]
# File lib/spec/interop/test/unit/testcase.rb, line 50
      def run(ignore_this_argument=nil)
        super()
      end