Guest User

Untitled

a guest
May 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. gem 'test-unit', '>= 2.1.1'
  2. require 'test/unit'
  3.  
  4. MYVERSION = '0.9.0' #Version of the class you test
  5.  
  6.  
  7. class Test_omit < Test::Unit::TestCase
  8. def test_omit
  9. omit('The following assertion fails - it will be corrected in the next release')
  10. assert_equal(1,2)
  11. end
  12.  
  13. def test_omit_if
  14. omit_if(MYVERSION < '1.0.0', "Test skipped for version #{MYVERSION}")
  15. assert_equal(1,2)
  16. end
  17.  
  18. end
  19.  
  20. Loaded suite test
  21. Started
  22. O
  23. ===============================================================================
  24. The following assertion fails - it will be corrected in the next release [test_omit(Test_omit)]
  25. test.rb:10:in `test_omit'
  26. ===============================================================================
  27. O
  28. ===============================================================================
  29. Test skipped for version 0.9.0 [test_omit_if(Test_omit)]
  30. test.rb:15:in `test_omit_if'
  31. ===============================================================================
  32.  
  33.  
  34. Finished in 0.0 seconds.
  35.  
  36. 2 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 2 omissions, 0 notifications
  37. 0% passed
  38.  
  39. @Test
  40. public void test() {
  41. // this is wrong, it should be fixed some time
  42. Assert.assertEquals(2, new Calculator().plus(2,2));
  43. // this is the expected behaviour, replace the above test when the fix is available
  44. // Assert.assertEquals(4, new Calculator().plus(2, 2));
  45. }
  46.  
  47. @Test
  48. public void test() {
  49. Assert.assertEquals(2, new Calculator().plus(2,2));
  50. }
  51.  
  52. @Ignore("fix me, Calculator is giving the wrong result, see ticket BUG-12345 and delete #test() when fixed")
  53. @Test
  54. public void fixMe() {
  55. Assert.assertEquals(4, new Calculator().plus(2, 2));
  56. }
Add Comment
Please, Sign In to add comment