Created
July 29, 2016 17:13
-
-
Save drbrain/7c0361031ea0252669d85fa63bccd02d to your computer and use it in GitHub Desktop.
Two ways of testing modules with Minitest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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