Created
November 21, 2014 10:16
-
-
Save reggieb/c7c2c08b231e7ee674da to your computer and use it in GitHub Desktop.
Reusing minitest tests via their method names
This file contains hidden or 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 NumberTest < ActiveSupport::TestCase | |
| def setup | |
| @number = 4 | |
| end | |
| def test_number_is_four | |
| assert_equal 4, @number | |
| end | |
| def test_double_number | |
| test_number_is_four | |
| @number = @number * 2 | |
| assert_equal 8, @number | |
| end | |
| def test_halfing_number_after_number_is_doubled_returns_it_to_original | |
| test_double_number | |
| @number = @number / 2 | |
| test_number_is_four | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used in a comment to this blog: http://brandonhilkert.com/blog/7-reasons-why-im-sticking-with-minitest-and-fixtures-in-rails/