rubyunit 0.2.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -5
  3. data/TestSuite.rb +7 -23
  4. data/lib/RubyUnit/AssertionFailure.rb +9 -9
  5. data/lib/RubyUnit/AssertionMessage.rb +70 -0
  6. data/lib/RubyUnit/Assertions/Basic.rb +121 -0
  7. data/lib/RubyUnit/Assertions/Class.rb +196 -0
  8. data/lib/RubyUnit/Assertions/Collection.rb +80 -0
  9. data/lib/RubyUnit/Assertions/Comparison.rb +200 -0
  10. data/lib/RubyUnit/Assertions/Exception.rb +105 -0
  11. data/lib/RubyUnit/Assertions/Method.rb +157 -0
  12. data/lib/RubyUnit/Assertions.rb +9 -636
  13. data/lib/RubyUnit/Runner.rb +1 -2
  14. data/lib/RubyUnit.rb +28 -4
  15. data/tests/AssertionFailure/TC_Class.rb +2 -13
  16. data/tests/AssertionFailure/TC_Instance.rb +1 -1
  17. data/tests/AssertionFailure/data/Instance.rb +3 -3
  18. data/tests/AssertionMessage/TC_Constant.rb +20 -0
  19. data/tests/AssertionMessage/data/Constant.rb +70 -0
  20. data/tests/Assertions/TC_Basic.rb +349 -0
  21. data/tests/Assertions/TC_Class.rb +75 -0
  22. data/tests/Assertions/TC_Comparison.rb +13 -0
  23. data/tests/Assertions/data/Basic.rb +90 -0
  24. data/tests/Assertions/data/Class.rb +54 -0
  25. data/tests/Assertions/data/Comparison.rb +7 -0
  26. data/tests/Assertions/data/ObjectTypes.rb +174 -0
  27. data/tests/IncompleteTest/TC_IncompleteTest.rb +15 -0
  28. data/tests/RubyUnit/TC_RubyUnit.rb +30 -0
  29. data/tests/RubyUnit/data/RubyUnit.rb +16 -0
  30. data/tests/Runner/TC_Runner.rb +9 -0
  31. data/tests/SkippedTest/TC_SkippedTest.rb +15 -0
  32. data/tests/TS_AssertionFailure.rb +4 -2
  33. data/tests/TS_AssertionMessage.rb +9 -0
  34. data/tests/TS_Assertions.rb +67 -0
  35. data/tests/TS_IncompleteTest.rb +9 -0
  36. data/tests/TS_RubyUnit.rb +4 -2
  37. data/tests/TS_Runner.rb +9 -0
  38. data/tests/TS_SkippedTest.rb +9 -0
  39. data/tests/TS_TestCase.rb +9 -0
  40. data/tests/TestCase/TC_TestCase.rb +120 -0
  41. data/tests/TestCase/data/TestCase.rb +24 -0
  42. metadata +32 -12
  43. data/tests/AssertionFailure/data/Class.rb +0 -12
  44. data/tests/TEST_Assertions.rb +0 -37
  45. data/tests/TEST_IncompleteTest.rb +0 -13
  46. data/tests/TEST_Runner.rb +0 -7
  47. data/tests/TEST_SkippedTest.rb +0 -13
  48. data/tests/TEST_TestCase.rb +0 -122
  49. data/tests/data/Assertions.rb +0 -23
  50. data/tests/data/TestCase.rb +0 -22
  51. data/tests/fixture/TestCase.rb +0 -6
@@ -0,0 +1,24 @@
1
+ module TestCaseTests
2
+ #
3
+ # Data provider for RubyUnit::TestCase class Test Case
4
+ #
5
+ module TestCaseTestsData
6
+ def classMethodData
7
+ [
8
+ [ :setup],
9
+ [ :teardown],
10
+ [:descendents],
11
+ [ :assertions],
12
+ ]
13
+ end
14
+
15
+ def instanceMethodData
16
+ [
17
+ [ :setup],
18
+ [ :teardown],
19
+ [ :markSkipped],
20
+ [ :markIncomplete],
21
+ ]
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Clower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-18 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Unit testing and test-driven development are crucial parts of the software
14
14
  development life cycle. This tool is intended to make development and testing in
15
- Ruby easier on everyone.
15
+ Ruby easier on everyone. RubyUnit is also designed to with a focus on data-driven
16
+ testing.
16
17
  email:
17
18
  - matthewclower@gmail.com
18
19
  executables: []
@@ -29,28 +30,47 @@ files:
29
30
  - example/TestSet.rb
30
31
  - lib/RubyUnit.rb
31
32
  - lib/RubyUnit/AssertionFailure.rb
33
+ - lib/RubyUnit/AssertionMessage.rb
32
34
  - lib/RubyUnit/Assertions.rb
35
+ - lib/RubyUnit/Assertions/Basic.rb
36
+ - lib/RubyUnit/Assertions/Class.rb
37
+ - lib/RubyUnit/Assertions/Collection.rb
38
+ - lib/RubyUnit/Assertions/Comparison.rb
39
+ - lib/RubyUnit/Assertions/Exception.rb
40
+ - lib/RubyUnit/Assertions/Method.rb
33
41
  - lib/RubyUnit/IncompleteTest.rb
34
42
  - lib/RubyUnit/Runner.rb
35
43
  - lib/RubyUnit/SkippedTest.rb
36
44
  - lib/RubyUnit/TestCase.rb
37
45
  - tests/AssertionFailure/TC_Class.rb
38
46
  - tests/AssertionFailure/TC_Instance.rb
39
- - tests/AssertionFailure/data/Class.rb
40
47
  - tests/AssertionFailure/data/Instance.rb
48
+ - tests/AssertionMessage/TC_Constant.rb
49
+ - tests/AssertionMessage/data/Constant.rb
50
+ - tests/Assertions/TC_Basic.rb
51
+ - tests/Assertions/TC_Class.rb
52
+ - tests/Assertions/TC_Comparison.rb
53
+ - tests/Assertions/data/Basic.rb
54
+ - tests/Assertions/data/Class.rb
55
+ - tests/Assertions/data/Comparison.rb
56
+ - tests/Assertions/data/ObjectTypes.rb
57
+ - tests/IncompleteTest/TC_IncompleteTest.rb
41
58
  - tests/RubyUnit/TC_GemInfo.rb
42
59
  - tests/RubyUnit/TC_RubyUnit.rb
43
60
  - tests/RubyUnit/data/GemInfo.rb
44
- - tests/TEST_Assertions.rb
45
- - tests/TEST_IncompleteTest.rb
46
- - tests/TEST_Runner.rb
47
- - tests/TEST_SkippedTest.rb
48
- - tests/TEST_TestCase.rb
61
+ - tests/RubyUnit/data/RubyUnit.rb
62
+ - tests/Runner/TC_Runner.rb
63
+ - tests/SkippedTest/TC_SkippedTest.rb
49
64
  - tests/TS_AssertionFailure.rb
65
+ - tests/TS_AssertionMessage.rb
66
+ - tests/TS_Assertions.rb
67
+ - tests/TS_IncompleteTest.rb
50
68
  - tests/TS_RubyUnit.rb
51
- - tests/data/Assertions.rb
52
- - tests/data/TestCase.rb
53
- - tests/fixture/TestCase.rb
69
+ - tests/TS_Runner.rb
70
+ - tests/TS_SkippedTest.rb
71
+ - tests/TS_TestCase.rb
72
+ - tests/TestCase/TC_TestCase.rb
73
+ - tests/TestCase/data/TestCase.rb
54
74
  homepage: http://github.com/RubyUnit/RubyUnit
55
75
  licenses:
56
76
  - Ruby
@@ -1,12 +0,0 @@
1
- module AssertionFailureTests
2
- #
3
- # Data provider for RubyUnit::AssertionFailure class Test Case
4
- #
5
- module ClassTestsData
6
- def constantData
7
- [
8
- ['FAILING'],
9
- ]
10
- end
11
- end
12
- end
@@ -1,37 +0,0 @@
1
- require 'RubyUnit/Assertions'
2
-
3
- # Data provider for RubyUnit::TestCase tests
4
- require_relative 'data/Assertions'
5
-
6
- #
7
- # Test Case for RubyUnit::Assertions module
8
- #
9
- class TEST_Assertions < RubyUnit::TestCase
10
- include AssertionsData
11
- @assertions
12
-
13
- #
14
- # Setup tests
15
- #
16
- def setup
17
- @assertions = RubyUnit::TestCase.assertions
18
- end
19
-
20
- #
21
- # Wrapper to rescue assertions
22
- #
23
- def rescue_assertion pattern = '', message = nil, data = {}, &block
24
- assertRaiseExpected RubyUnit::AssertionFailure, pattern, message do
25
- yield
26
- end
27
- end
28
-
29
- #
30
- # Test for default failure
31
- #
32
- def failDefaultTest
33
- rescue_assertion /#{RubyUnit::AssertionFailure::FAILING}/ do
34
- fail
35
- end
36
- end
37
- end
@@ -1,13 +0,0 @@
1
- require 'RubyUnit/IncompleteTest'
2
-
3
- #
4
- # Test Case for RubyUnit::IncompleteTest
5
- #
6
- class TEST_IncompleteTest < RubyUnit::TestCase
7
- #
8
- # Validate that RubyUnit::IncompleteTest is an Exception
9
- #
10
- def isExceptionTest
11
- assertDescendent Exception, RubyUnit::IncompleteTest, 'IncompleteTest MUST be an Exception'
12
- end
13
- end
data/tests/TEST_Runner.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'RubyUnit/Runner'
2
-
3
- #
4
- # Test Case for the RubyUnit::Runner
5
- #
6
- class TEST_Runner < RubyUnit::TestCase
7
- end
@@ -1,13 +0,0 @@
1
- require 'RubyUnit/SkippedTest'
2
-
3
- #
4
- # Test Case for RubyUnit::SkippedTest
5
- #
6
- class TEST_SkippedTest < RubyUnit::TestCase
7
- #
8
- # Validate that RubyUnit::SkippedTest is an Exception
9
- #
10
- def isExceptionTest
11
- assertDescendent Exception, RubyUnit::SkippedTest, 'SkippedTest MUST be an Exception!'
12
- end
13
- end
@@ -1,122 +0,0 @@
1
- require 'RubyUnit/TestCase'
2
-
3
- # Data provider for RubyUnit::TestCase tests
4
- require_relative 'data/TestCase'
5
-
6
- # Fixture for RubyUnit::TestCase tests
7
- require_relative 'fixture/TestCase'
8
-
9
- #
10
- # Test Case for the RubyUnit::TestCase
11
- #
12
- class TEST_TestCase < RubyUnit::TestCase
13
- include TestCaseData
14
- @setup
15
- @teardown
16
-
17
- #
18
- # Initialize setup and teardown before each test
19
- #
20
- def initialize
21
- super
22
- @setup = false
23
- @teardown = false
24
- end
25
-
26
- class << self
27
- # Track whether class setup has been run
28
- @@setup = false
29
- # Track whether class teardown has been run
30
- @@teardown = false
31
-
32
- #
33
- # Setup before class
34
- #
35
- def setup
36
- @@setup = true
37
- end
38
-
39
- #
40
- # Teardown after class
41
- #
42
- def teardown
43
- @@teardown = true
44
- end
45
- end
46
-
47
- #
48
- # Setup before test
49
- # * self.setup has been run before test begins
50
- # * self.teardown has not been run before test begins
51
- # * setup is only run once
52
- #
53
- def setup
54
- assert @@setup, 'setup class method MUST be run before tests begin.'
55
- assertNot @@teardown, 'teardown class should NOT be run before testing'
56
- assertNot @setup, 'setup instance method should only be run once'
57
- @setup = true
58
- end
59
-
60
- #
61
- # Teardown after test
62
- #
63
- def teardown
64
- @teardown = true
65
- end
66
-
67
- #
68
- # Test that descendents method includes this class
69
- #
70
- def descendentsTest
71
- assertInclude RubyUnit::TestCase.descendents, self.class, 'Should be a descendent of RubyUnit::TestCase'
72
- end
73
-
74
- #
75
- # Test that the correct class methods are defined
76
- #
77
- def classMethodTest method
78
- assertRespondTo RubyUnit::TestCase, method, 'RubyUnit::TestCase missing class method'
79
- end
80
-
81
- #
82
- # Test that the correct instance methods are defined
83
- #
84
- def instanceMethodTest method
85
- test_case = TestCaseFixture.new
86
- assertRespondTo test_case, method, 'TestCase object missing instance method'
87
- end
88
-
89
- #
90
- # Test that setup is run before test
91
- #
92
- def setupBeforeTestTest
93
- assert @setup, 'setup instance method MUST be run before test'
94
- end
95
-
96
- #
97
- # Test that teardown is not run before test
98
- #
99
- def noTeardownBeforeTestTest
100
- assertNot @teardown, 'teardown instance method should NOT be run before test'
101
- end
102
-
103
- #
104
- # Test that markSkipped raises proper exception
105
- #
106
- def markSkippedTest
107
- message = 'markSkipped should raise RubyUnit::SkippedTest'
108
- assertRaiseExpected RubyUnit::SkippedTest, message, message do
109
- markSkipped message
110
- end
111
- end
112
-
113
- #
114
- # Test that markIncomplete raises proper exception
115
- #
116
- def markIncompleteTest
117
- message = 'markIncomplete should raise RubyUnit::IncompleteTest'
118
- assertRaiseExpected RubyUnit::IncompleteTest, message, message do
119
- markIncomplete message
120
- end
121
- end
122
- end
@@ -1,23 +0,0 @@
1
- #
2
- # Data provider for RubyUnit::TestCase class Test Case
3
- #
4
- module AssertionsData
5
- #
6
- # Create data string that will be in assertion from data list
7
- # * This makes me really want to build RubyUnit::AssertionFailure properly
8
- #
9
- def data_string data = {}
10
- error_message = ''
11
- data.each do |index, value|
12
- error_message << "\n#{index}:\n\t#{value.inspect}"
13
- end
14
- error_message
15
- end
16
-
17
- def failData
18
- [
19
- ['message' ],
20
- ['message', {:string=>'test',:int=>10}],
21
- ]
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- #
2
- # Data provider for RubyUnit::TestCase class Test Case
3
- #
4
- module TestCaseData
5
- def classMethodData
6
- [
7
- [ :setup],
8
- [ :teardown],
9
- [:descendents],
10
- [ :assertions],
11
- ]
12
- end
13
-
14
- def instanceMethodData
15
- [
16
- [ :setup],
17
- [ :teardown],
18
- [ :markSkipped],
19
- [ :markIncomplete],
20
- ]
21
- end
22
- end
@@ -1,6 +0,0 @@
1
- #
2
- # Fixture for RubyUnit::TestCase tests
3
- #
4
- class TestCaseFixture < RubyUnit::TestCase
5
- # This is a fixture, NO TESTS
6
- end