I'm trying to use minitest/stub_any_instance but I keep getting an error stating that Tempfile has no method stub_any_instance. A snippet of code is below - can someone tell where where I'm going wrong? From reading the stub_any_instance source I expected it to add stub_any_instance to all object types but perhaps there's something I'm missing. Thanks.
require 'test_helper'
require 'minitest/stub_any_instance'
class MyTests < ActionDispatch::IntegrationTest
test "failure to create temp file causes failure" do
Tempfile.stub_any_instance :new, raise("Fake failure") do
...some testing here
end
end
end
Aucun commentaire:
Enregistrer un commentaire