Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
オブジェクトのリストがあり、特定のメソッドの呼び出しを受け取るものと受け取らないものがあることを確認したいと思います。
テストの依存関係を追加せずにこれを行うことに興味があります(したがって、モカやその他のモック/スタブフレームワークはありません)。
テストを記述して、通常行うモックを作成してから、verifyメソッド呼び出しをでラップすることができますassert_raises。
verify
assert_raises
@mock = MiniTest::Mock.new @mock.expect :update, true Foo.do_something @mock assert_raises(MockExpectationError, "update should not be called") do @mock.verify end