Skip to content

Instantly share code, notes, and snippets.

@drbrain
Created July 29, 2016 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drbrain/7c0361031ea0252669d85fa63bccd02d to your computer and use it in GitHub Desktop.
Save drbrain/7c0361031ea0252669d85fa63bccd02d to your computer and use it in GitHub Desktop.
Two ways of testing modules with Minitest
class TestMyModule < Minitest::Test
include MyModule
def test_method_from_my_module
actual = method_from_my_module input_data
assert_equal 'something', actual
end
end
class TestMyModule < Minitest::Test
class TestClass
include MyModule
end
def test_method_from_my_module
obj = TestClass.new
obj.method_from_my_module input_data
assert_equal 'something', actual
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment