require 'rubygems'
require 'test/unit'
class Thing
attr_accessor :foo
def set_stuff
@foo = 'bar'
end
end
class ThingTest < Test::Unit::TestCase
def setup
@thing = Thing.new
end
def test_set_stuff
@thing.set_stuff
assert 'bar' == @thing.foo
end
def test_foo_in_other_test
puts @thing.foo
assert 'bar' == @thing.foo
end
end
# Loaded suite testing
# Started
# nil
# F.
# Finished in 0.00439 seconds.
#
# 1) Failure:
# test_foo_in_other_test(ThingTest) [testing.rb:26]:
# <false> is not true.
#
# 2 tests, 2 assertions, 1 failures, 0 errors
问问题
528 次