Sha256: bf468f347116787a2d0645c5c4e94a560c1a1fcd9a540376437b33b58fadbb8f

Contents?: true

Size: 1.4 KB

Versions: 32

Compression:

Stored size: 1.4 KB

Contents

require 'test/unit/testcase'

module Test
  module Unit
    # 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
    class TestCase
      extend Spec::Example::ExampleGroupMethods
      include Spec::Example::ExampleMethods

      def self.suite
        Test::Unit::TestSuiteAdapter.new(self)
      end

      def self.example_method?(method_name)
        should_method?(method_name) || test_method?(method_name)
      end

      def self.test_method?(method_name)
        method_name =~ /^test./ && (
          instance_method(method_name).arity == 0 ||
          instance_method(method_name).arity == -1
        )
      end

      before(:each) {setup}
      after(:each) {teardown}

      def initialize(description, &implementation)
        super
        # Some Test::Unit extensions depend on @method_name being present.
        @method_name = description.description
        @_result = ::Test::Unit::TestResult.new
      end

      def run(ignore_this_argument=nil)
        super()
      end

    end
  end
end

Version data entries

32 entries across 32 versions & 11 rubygems

Version Path
rspec-instructure-1.3.3 lib/spec/interop/test/unit/testcase.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/lib/spec/interop/test/unit/testcase.rb
rspec-1.3.2 lib/spec/interop/test/unit/testcase.rb
rspec-1.3.1 lib/spec/interop/test/unit/testcase.rb
rspec-1.3.1.rc lib/spec/interop/test/unit/testcase.rb
rspec-1.3.0 lib/spec/interop/test/unit/testcase.rb
hubbub-0.0.11 lib/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
hubbub-0.0.10 lib/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
hubbub-0.0.9 lib/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
hubbub-0.0.8 lib/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
hubbub-0.0.6 lib/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
simple-templater-0.0.1.4 gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/testcase.rb
media-path-0.1.2 vendor/rspec/lib/spec/interop/test/unit/testcase.rb
simple-templater-0.0.1.3 vendor/rspec/lib/spec/interop/test/unit/testcase.rb
pupu-0.0.2.pre vendor/rspec/lib/spec/interop/test/unit/testcase.rb
media-path-0.1.1.pre vendor/rspec/lib/spec/interop/test/unit/testcase.rb
simple-templater-0.0.1.2 vendor/rspec/lib/spec/interop/test/unit/testcase.rb
media-path-0.1.1 vendor/rspec/lib/spec/interop/test/unit/testcase.rb
simple-templater-0.0.1.1 vendor/rspec/lib/spec/interop/test/unit/testcase.rb
pupu-0.0.2 vendor/rspec/lib/spec/interop/test/unit/testcase.rb