Sha256: 88fb27f768393f6c44d65ba78b56209fc86eedd976cfc042d53bbd5cc9514c0f

Contents?: true

Size: 1.64 KB

Versions: 44

Compression:

Stored size: 1.64 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 '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
    class TestCase
      extend Spec::Example::ExampleGroupMethods
      include Spec::Example::ExampleMethods

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

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

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

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

      def initialize(defined_description, &implementation)
        @_defined_description = defined_description
        @_implementation = implementation

        @_result = ::Test::Unit::TestResult.new
        # @method_name is important to set here because it "complies" with Test::Unit's interface.
        # Some Test::Unit extensions depend on @method_name being present.
        @method_name = @_defined_description
      end

      def run(ignore_this_argument=nil)
        super()
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.1 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.0 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.4 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.2 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.3 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.6 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.5 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.7 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
picolena-0.1.8 rails_plugins/rspec/lib/spec/interop/test/unit/testcase.rb
pictrails-0.5.0 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
radiant-0.6.5.1 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
radiant-0.6.5 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
radiant-0.6.6 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
radiant-0.6.7 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
radiant-0.6.9 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb