るりまサーチ

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.012秒)
トップページ > クエリ:init[x] > クエリ:teardown[x]

別のキーワード

  1. cgi/html element_init
  2. cgi element_init
  3. irb/ext/save-history init_save_history
  4. inspector init
  5. packagetask init

検索結果

MiniTest::Unit::TestCase#teardown (21101.0)

各テストケースの実行後に実行するメソッドです。

各テストケースの実行後に実行するメソッドです。

サブクラスで再定義します。

minitest/unit (6018.0)

ユニットテストを行うためのライブラリです。

...ユニットテストを行うためのライブラリです。

=== 使い方

minitest/unit は以下のように使います。

テスト対象のソース (foo.rb) を用意します。

class Foo
def foo
"foo"
end
def bar
"foo"
end
end

次にユニットテス...
...が実行された後には teardown メソッドが必ず実行されます。

minitest/unit を Kernel.#require しただけではテストが自動実行されません。

require 'minitest/unit'
require 'foo'

MiniTest::Unit.autorun

class TestFoo < MiniTest::Unit::TestCase
def...
...tup
@foo = Foo.new
end
# teardown はあまり使わない
def teardown
@foo = nil
end

def test_foo
assert_equal "foo", @foo.foo
end

def test_bar
assert_equal "bar", @foo.bar
end
end

または MiniTest::Unit.autorun を省略して以...