Hey guys! I'd like to figure out a way to test piece of code that suppose to create an instance of particular class. Here is an example:
class Subject def call ... end end class Executor def action Subject.new.call end end class ExecutorTest < Minitest::Test def test_subject_was_instantiated # How to ensure that Subject instance was created? end def test_subject_was_called # How to ensure that Executor send :call message to Subject instance? end end
I guess, I'm missing some concept or testing pattern here. Any advice?
Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.