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.
- checksums.yaml +4 -4
- data/README.md +4 -5
- data/TestSuite.rb +7 -23
- data/lib/RubyUnit/AssertionFailure.rb +9 -9
- data/lib/RubyUnit/AssertionMessage.rb +70 -0
- data/lib/RubyUnit/Assertions/Basic.rb +121 -0
- data/lib/RubyUnit/Assertions/Class.rb +196 -0
- data/lib/RubyUnit/Assertions/Collection.rb +80 -0
- data/lib/RubyUnit/Assertions/Comparison.rb +200 -0
- data/lib/RubyUnit/Assertions/Exception.rb +105 -0
- data/lib/RubyUnit/Assertions/Method.rb +157 -0
- data/lib/RubyUnit/Assertions.rb +9 -636
- data/lib/RubyUnit/Runner.rb +1 -2
- data/lib/RubyUnit.rb +28 -4
- data/tests/AssertionFailure/TC_Class.rb +2 -13
- data/tests/AssertionFailure/TC_Instance.rb +1 -1
- data/tests/AssertionFailure/data/Instance.rb +3 -3
- data/tests/AssertionMessage/TC_Constant.rb +20 -0
- data/tests/AssertionMessage/data/Constant.rb +70 -0
- data/tests/Assertions/TC_Basic.rb +349 -0
- data/tests/Assertions/TC_Class.rb +75 -0
- data/tests/Assertions/TC_Comparison.rb +13 -0
- data/tests/Assertions/data/Basic.rb +90 -0
- data/tests/Assertions/data/Class.rb +54 -0
- data/tests/Assertions/data/Comparison.rb +7 -0
- data/tests/Assertions/data/ObjectTypes.rb +174 -0
- data/tests/IncompleteTest/TC_IncompleteTest.rb +15 -0
- data/tests/RubyUnit/TC_RubyUnit.rb +30 -0
- data/tests/RubyUnit/data/RubyUnit.rb +16 -0
- data/tests/Runner/TC_Runner.rb +9 -0
- data/tests/SkippedTest/TC_SkippedTest.rb +15 -0
- data/tests/TS_AssertionFailure.rb +4 -2
- data/tests/TS_AssertionMessage.rb +9 -0
- data/tests/TS_Assertions.rb +67 -0
- data/tests/TS_IncompleteTest.rb +9 -0
- data/tests/TS_RubyUnit.rb +4 -2
- data/tests/TS_Runner.rb +9 -0
- data/tests/TS_SkippedTest.rb +9 -0
- data/tests/TS_TestCase.rb +9 -0
- data/tests/TestCase/TC_TestCase.rb +120 -0
- data/tests/TestCase/data/TestCase.rb +24 -0
- metadata +32 -12
- data/tests/AssertionFailure/data/Class.rb +0 -12
- data/tests/TEST_Assertions.rb +0 -37
- data/tests/TEST_IncompleteTest.rb +0 -13
- data/tests/TEST_Runner.rb +0 -7
- data/tests/TEST_SkippedTest.rb +0 -13
- data/tests/TEST_TestCase.rb +0 -122
- data/tests/data/Assertions.rb +0 -23
- data/tests/data/TestCase.rb +0 -22
- 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.
|
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-
|
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/
|
45
|
-
- tests/
|
46
|
-
- tests/
|
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/
|
52
|
-
- tests/
|
53
|
-
- tests/
|
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
|
data/tests/TEST_Assertions.rb
DELETED
@@ -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
data/tests/TEST_SkippedTest.rb
DELETED
@@ -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
|
data/tests/TEST_TestCase.rb
DELETED
@@ -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
|
data/tests/data/Assertions.rb
DELETED
@@ -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
|
data/tests/data/TestCase.rb
DELETED
@@ -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
|