class Test::Unit::TestCase
See also Spec::Example::ExampleGroup
end
end
(3+1).should == 5
def test_should_work_with_rspec_expectations
end
assert_equal 4, 2+1
it “should work with Test::Unit assertions” do
class MyTest < Test::Unit::TestCase
require ‘spec’
require ‘test/unit’
available from within, so that you can do things like:
This extension of the standard Test::Unit::TestCase makes RSpec
def example_method?(method_name)
def example_method?(method_name) should_method?(method_name) || test_method?(method_name) end
def initialize(defined_description, &implementation)
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)
def run(ignore_this_argument=nil) super() end
def suite
def suite Test::Unit::TestSuiteAdapter.new(self) end
def test_method?(method_name)
def test_method?(method_name) method_name =~ /^test[_A-Z]./ && ( instance_method(method_name).arity == 0 || instance_method(method_name).arity == -1 ) end