assert 0.1.0
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.
- data/.gitignore +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +17 -0
- data/README.rdoc +77 -0
- data/Rakefile +7 -0
- data/assert.gemspec +21 -0
- data/examples/empty_test.rb +5 -0
- data/examples/results_test.rb +25 -0
- data/examples/single_test.rb +9 -0
- data/lib/assert.rb +8 -0
- data/lib/assert/assertions.rb +253 -0
- data/lib/assert/context.rb +196 -0
- data/lib/assert/options.rb +43 -0
- data/lib/assert/rake_tasks.rb +95 -0
- data/lib/assert/result.rb +164 -0
- data/lib/assert/result_set.rb +14 -0
- data/lib/assert/runner.rb +60 -0
- data/lib/assert/setup/autorun.rb +34 -0
- data/lib/assert/setup/helpers.rb +62 -0
- data/lib/assert/setup/suite.rb +12 -0
- data/lib/assert/setup/view.rb +11 -0
- data/lib/assert/suite.rb +128 -0
- data/lib/assert/test.rb +90 -0
- data/lib/assert/version.rb +3 -0
- data/lib/assert/view/base.rb +54 -0
- data/lib/assert/view/terminal.rb +138 -0
- data/test/assertions/assert_block_test.rb +39 -0
- data/test/assertions/assert_instance_of_test.rb +43 -0
- data/test/assertions/assert_kind_of_test.rb +43 -0
- data/test/assertions/assert_not_block_test.rb +39 -0
- data/test/assertions/assert_not_instance_of_test.rb +43 -0
- data/test/assertions/assert_not_kind_of_test.rb +43 -0
- data/test/assertions/assert_not_respond_to_test.rb +43 -0
- data/test/assertions/assert_nothing_raised_test.rb +46 -0
- data/test/assertions/assert_raises_test.rb +49 -0
- data/test/assertions/assert_respond_to_test.rb +43 -0
- data/test/assertions_test.rb +334 -0
- data/test/context/class_methods_test.rb +314 -0
- data/test/context_test.rb +288 -0
- data/test/fixtures/inherited_stuff.rb +36 -0
- data/test/fixtures/sample_context.rb +13 -0
- data/test/helper.rb +52 -0
- data/test/irb.rb +10 -0
- data/test/options_test.rb +78 -0
- data/test/result_set_test.rb +89 -0
- data/test/result_test.rb +255 -0
- data/test/runner_test.rb +33 -0
- data/test/suite_test.rb +200 -0
- data/test/test/running_test.rb +327 -0
- data/test/test_test.rb +184 -0
- data/test/view_test.rb +35 -0
- metadata +155 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'assert'
|
2
|
+
|
3
|
+
require 'assert/result_set'
|
4
|
+
require 'assert/result'
|
5
|
+
require 'assert/view/base'
|
6
|
+
|
7
|
+
class FakeView < Assert::View::Base
|
8
|
+
attr_accessor :printed
|
9
|
+
|
10
|
+
def initialize(suite, output_io)
|
11
|
+
super
|
12
|
+
self.printed = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def print_runtime_result(result)
|
16
|
+
self.printed.push(result)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Assert::ResultSet
|
22
|
+
class BasicTest < Assert::Context
|
23
|
+
desc "Assert result set"
|
24
|
+
setup do
|
25
|
+
@result_set = Assert::ResultSet.new
|
26
|
+
end
|
27
|
+
subject { @result_set }
|
28
|
+
|
29
|
+
INSTANCE_METHODS = [
|
30
|
+
:view, :view=
|
31
|
+
]
|
32
|
+
INSTANCE_METHODS.each do |method|
|
33
|
+
should "respond to the instance method ##{method}" do
|
34
|
+
assert_respond_to subject, method
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
class ViewTest < BasicTest
|
41
|
+
desc "view"
|
42
|
+
setup do
|
43
|
+
@view_s = ""
|
44
|
+
@view = @result_set.view = FakeView.new(nil, StringIO.new(@view_s, "w+"))
|
45
|
+
|
46
|
+
@pass_result = Assert::Result::Pass.new("test", "pass", [])
|
47
|
+
@result_set << @pass_result
|
48
|
+
@fail_result = Assert::Result::Fail.new("test", "fail", [])
|
49
|
+
@result_set << @fail_result
|
50
|
+
@skip_result = Assert::Result::Skip.new("test", RuntimeError.new)
|
51
|
+
@result_set << @skip_result
|
52
|
+
@error_result = Assert::Result::Error.new("test", RuntimeError.new)
|
53
|
+
@result_set << @error_result
|
54
|
+
end
|
55
|
+
subject{ @view }
|
56
|
+
|
57
|
+
should "have 'printed' 1 pass result" do
|
58
|
+
pass_results = @view.printed.reject{|r| !r.pass? }
|
59
|
+
assert_equal 1, pass_results.size
|
60
|
+
assert_kind_of Assert::Result::Pass, pass_results.first
|
61
|
+
assert_equal @pass_result.test_name, pass_results.first.test_name
|
62
|
+
assert_equal @pass_result.message, pass_results.first.message
|
63
|
+
end
|
64
|
+
should "have 'printed' 1 fail result" do
|
65
|
+
fail_results = @view.printed.reject{|r| !r.fail? }
|
66
|
+
assert_equal 1, fail_results.size
|
67
|
+
assert_kind_of Assert::Result::Fail, fail_results.first
|
68
|
+
assert_equal @fail_result.test_name, fail_results.first.test_name
|
69
|
+
assert_equal @fail_result.message, fail_results.first.message
|
70
|
+
end
|
71
|
+
should "have 'printed' 1 skip result" do
|
72
|
+
skip_results = @view.printed.reject{|r| !r.skip? }
|
73
|
+
assert_equal 1, skip_results.size
|
74
|
+
assert_kind_of Assert::Result::Skip, skip_results.first
|
75
|
+
assert_equal @skip_result.test_name, skip_results.first.test_name
|
76
|
+
assert_equal @skip_result.message, skip_results.first.message
|
77
|
+
end
|
78
|
+
should "have 'printed' 1 error result" do
|
79
|
+
error_results = @view.printed.reject{|r| !r.error? }
|
80
|
+
assert_equal 1, error_results.size
|
81
|
+
assert_kind_of Assert::Result::Error, error_results.first
|
82
|
+
assert_equal @error_result.test_name, error_results.first.test_name
|
83
|
+
assert_equal @error_result.message, error_results.first.message
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
data/test/result_test.rb
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
require 'assert'
|
2
|
+
|
3
|
+
require 'assert/result'
|
4
|
+
|
5
|
+
module Assert::Result
|
6
|
+
|
7
|
+
class BacktraceTest < Assert::Context
|
8
|
+
desc "a result backtrace"
|
9
|
+
setup{ @backtrace = Backtrace.new(caller) }
|
10
|
+
subject { @backtrace }
|
11
|
+
|
12
|
+
INSTANCE_METHODS = [
|
13
|
+
:to_s, :filtered
|
14
|
+
]
|
15
|
+
INSTANCE_METHODS.each do |method|
|
16
|
+
should "respond to the instance method ##{method}" do
|
17
|
+
assert_respond_to subject, method
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
should "be an Array" do
|
22
|
+
assert_kind_of ::Array, subject
|
23
|
+
end
|
24
|
+
|
25
|
+
should "render as a string by joining on the newline" do
|
26
|
+
assert_equal subject.join("\n"), subject.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
should "another backtrace when filtered" do
|
30
|
+
assert_kind_of Backtrace, subject
|
31
|
+
end
|
32
|
+
|
33
|
+
should "default itself when created from nil" do
|
34
|
+
assert_equal ["No backtrace"], Backtrace.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class BaseTest < Assert::Context
|
39
|
+
desc "a base result"
|
40
|
+
setup do
|
41
|
+
@result = Assert::Result::Base.new("a test name", "a message", ["line 1", "line2"])
|
42
|
+
end
|
43
|
+
subject{ @result }
|
44
|
+
|
45
|
+
INSTANCE_METHODS = [
|
46
|
+
:test_name, :message, :backtrace, :to_sym, :to_s, :trace
|
47
|
+
]
|
48
|
+
INSTANCE_METHODS.each do |method|
|
49
|
+
should "respond to the instance method ##{method}" do
|
50
|
+
assert_respond_to subject, method
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Assert::Result.types.keys.each do |type|
|
55
|
+
should "respond to the instance method ##{type}?" do
|
56
|
+
assert_respond_to subject, "#{type}?"
|
57
|
+
end
|
58
|
+
|
59
|
+
should "not be #{type}" do
|
60
|
+
assert_equal false, subject.send("#{type}?")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
should "nil out empty messages" do
|
65
|
+
assert_equal nil, Assert::Result::Base.new("a test name", "").message
|
66
|
+
end
|
67
|
+
|
68
|
+
should "show only its class and message when inspected" do
|
69
|
+
assert_equal "#<#{subject.class} @message=#{subject.message.inspect}>", subject.inspect
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
class ToStringTest < BaseTest
|
75
|
+
should "include its test context name in the to_s" do
|
76
|
+
assert subject.to_s.include?(subject.test_name)
|
77
|
+
end
|
78
|
+
|
79
|
+
should "include its test name in the to_s" do
|
80
|
+
assert subject.to_s.include?(subject.test_name)
|
81
|
+
end
|
82
|
+
|
83
|
+
should "include its message in the to_s" do
|
84
|
+
assert subject.to_s.include?(subject.message)
|
85
|
+
end
|
86
|
+
|
87
|
+
should "include its trace in the to_s" do
|
88
|
+
assert subject.to_s.include?(subject.trace)
|
89
|
+
end
|
90
|
+
|
91
|
+
should "have a trace with the first filtered line of the backtrace" do
|
92
|
+
assert_equal subject.backtrace.filtered.first, subject.trace
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class PassTest < Assert::Context
|
97
|
+
desc "a pass result"
|
98
|
+
setup do
|
99
|
+
@result = Assert::Result::Pass.new("test", "passed", [])
|
100
|
+
end
|
101
|
+
subject { @result }
|
102
|
+
|
103
|
+
should "be pass?" do
|
104
|
+
assert_equal true, subject.pass?
|
105
|
+
end
|
106
|
+
|
107
|
+
Assert::Result.types.keys.reject{|k| k == :pass}.each do |type|
|
108
|
+
should "not be #{type}?" do
|
109
|
+
assert_equal false, subject.send("#{type}?")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
should "know its to_sym" do
|
114
|
+
assert_equal :passed, subject.to_sym
|
115
|
+
end
|
116
|
+
|
117
|
+
should "include PASS in its to_s" do
|
118
|
+
assert subject.to_s.include?("PASS")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
class FailTest < Assert::Context
|
123
|
+
desc "a fail result"
|
124
|
+
setup do
|
125
|
+
@result = Assert::Result::Fail.new("test", "failed", [])
|
126
|
+
end
|
127
|
+
subject { @result }
|
128
|
+
|
129
|
+
should "be fail?" do
|
130
|
+
assert_equal true, subject.fail?
|
131
|
+
end
|
132
|
+
|
133
|
+
Assert::Result.types.keys.reject{|k| k == :fail}.each do |type|
|
134
|
+
should "not be #{type}?" do
|
135
|
+
assert_equal false, subject.send("#{type}?")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
should "know its to_sym" do
|
140
|
+
assert_equal :failed, subject.to_sym
|
141
|
+
end
|
142
|
+
|
143
|
+
should "include FAIL in its to_s" do
|
144
|
+
assert subject.to_s.include?("FAIL")
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
class IgnoreTest < Assert::Context
|
149
|
+
desc "an ignore result"
|
150
|
+
setup do
|
151
|
+
@result = Assert::Result::Ignore.new("test", "ignored", [])
|
152
|
+
end
|
153
|
+
subject { @result }
|
154
|
+
|
155
|
+
should "be ignore?" do
|
156
|
+
assert_equal true, subject.ignore?
|
157
|
+
end
|
158
|
+
|
159
|
+
Assert::Result.types.keys.reject{|k| k == :ignore}.each do |type|
|
160
|
+
should "not be #{type}?" do
|
161
|
+
assert_equal false, subject.send("#{type}?")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
should "know its to_sym" do
|
166
|
+
assert_equal :ignored, subject.to_sym
|
167
|
+
end
|
168
|
+
|
169
|
+
should "include IGNORE in its to_s" do
|
170
|
+
assert subject.to_s.include?("IGNORE")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
class FromExceptionTest < Assert::Context
|
175
|
+
before do
|
176
|
+
begin
|
177
|
+
raise Exception, "test error"
|
178
|
+
rescue Exception => err
|
179
|
+
@exception = err
|
180
|
+
end
|
181
|
+
@result = Assert::Result::FromException.new("test", @exception)
|
182
|
+
end
|
183
|
+
subject{ @result }
|
184
|
+
|
185
|
+
should "have the same backtrace as the original exception it was created from" do
|
186
|
+
assert_equal @exception.backtrace, subject.backtrace
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
class SkippedRuntimeErrorTest < Assert::Context
|
192
|
+
|
193
|
+
should "be a runtime error" do
|
194
|
+
assert_kind_of RuntimeError, Assert::Result::TestSkipped.new
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
class SkipTest < FromExceptionTest
|
200
|
+
desc "a skip result"
|
201
|
+
setup do
|
202
|
+
@result = Assert::Result::Skip.new("test", @exception)
|
203
|
+
end
|
204
|
+
subject { @result }
|
205
|
+
|
206
|
+
should "be skip?" do
|
207
|
+
assert_equal true, subject.skip?
|
208
|
+
end
|
209
|
+
|
210
|
+
Assert::Result.types.keys.reject{|k| k == :skip}.each do |type|
|
211
|
+
should "not be #{type}?" do
|
212
|
+
assert_equal false, subject.send("#{type}?")
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
should "know its to_sym" do
|
217
|
+
assert_equal :skipped, subject.to_sym
|
218
|
+
end
|
219
|
+
|
220
|
+
should "include SKIP in its to_s" do
|
221
|
+
assert subject.to_s.include?("SKIP")
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class ErrorTest < FromExceptionTest
|
226
|
+
desc "an error result"
|
227
|
+
setup do
|
228
|
+
@result = Assert::Result::Error.new("test", @exception)
|
229
|
+
end
|
230
|
+
subject { @result }
|
231
|
+
|
232
|
+
should "be error?" do
|
233
|
+
assert_equal true, subject.error?
|
234
|
+
end
|
235
|
+
|
236
|
+
Assert::Result.types.keys.reject{|k| k == :error}.each do |type|
|
237
|
+
should "not be #{type}?" do
|
238
|
+
assert_equal false, subject.send("#{type}?")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
should "know its to_sym" do
|
243
|
+
assert_equal :errored, subject.to_sym
|
244
|
+
end
|
245
|
+
|
246
|
+
should "include ERRORED in its to_s" do
|
247
|
+
assert subject.to_s.include?("ERROR")
|
248
|
+
end
|
249
|
+
|
250
|
+
should "have a trace created from the original exception's unfiltered backtrace" do
|
251
|
+
assert_equal @exception.backtrace.join("\n"), subject.trace
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
data/test/runner_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'assert'
|
2
|
+
|
3
|
+
require 'assert/suite'
|
4
|
+
require 'assert/view/base'
|
5
|
+
require 'assert/runner'
|
6
|
+
|
7
|
+
class Assert::Runner
|
8
|
+
|
9
|
+
class BasicTest < Assert::Context
|
10
|
+
desc "a basic runner"
|
11
|
+
setup do
|
12
|
+
@suite = Assert::Suite.new
|
13
|
+
@view = Assert::View::Base.new(@suite, StringIO.new("", "w+"))
|
14
|
+
@runner = Assert::Runner.new(@suite, @view)
|
15
|
+
end
|
16
|
+
subject { @runner }
|
17
|
+
|
18
|
+
INSTANCE_METHODS = [
|
19
|
+
:run, :count
|
20
|
+
]
|
21
|
+
INSTANCE_METHODS.each do |method|
|
22
|
+
should "respond to the instance method ##{method}" do
|
23
|
+
assert_respond_to subject, method
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
should "return an integer exit code" do
|
28
|
+
assert_equal 0, subject.run
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/test/suite_test.rb
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
require 'assert'
|
2
|
+
|
3
|
+
require 'assert/suite'
|
4
|
+
require 'assert/context'
|
5
|
+
require 'assert/test'
|
6
|
+
require 'test/fixtures/inherited_stuff'
|
7
|
+
require 'test/fixtures/sample_context'
|
8
|
+
|
9
|
+
|
10
|
+
class Assert::Suite
|
11
|
+
|
12
|
+
class BasicTest < Assert::Context
|
13
|
+
desc "an basic suite"
|
14
|
+
setup do
|
15
|
+
@suite = Assert::Suite.new
|
16
|
+
end
|
17
|
+
subject { @suite }
|
18
|
+
|
19
|
+
INSTANCE_METHODS = [
|
20
|
+
:start_time, :end_time, :start_time=, :end_time=,
|
21
|
+
:<<,
|
22
|
+
:contexts, :tests, :ordered_tests, :ordered_results,
|
23
|
+
:count, :test_count, :result_count,
|
24
|
+
:run_time
|
25
|
+
]
|
26
|
+
INSTANCE_METHODS.each do |method|
|
27
|
+
should "respond to the instance method ##{method}" do
|
28
|
+
assert_respond_to subject, method
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be a hash" do
|
33
|
+
assert_kind_of ::Hash, subject
|
34
|
+
end
|
35
|
+
|
36
|
+
should "push contexts on itself" do
|
37
|
+
context_class = Factory.context_class
|
38
|
+
subject << context_class
|
39
|
+
assert_equal true, subject.has_key?(context_class)
|
40
|
+
assert_equal [], subject[context_class]
|
41
|
+
end
|
42
|
+
|
43
|
+
should "determine a klass' local public test methods" do
|
44
|
+
assert_equal(
|
45
|
+
["test_subclass_stuff", "test_mixin_stuff"].sort,
|
46
|
+
subject.send(:local_public_test_methods, SubStuff).sort
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
should "have zero run time by default" do
|
51
|
+
assert_equal 0, subject.run_time
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
class WithTestsTest < Assert::Context
|
57
|
+
desc "a suite with tests"
|
58
|
+
setup do
|
59
|
+
@suite = Assert::Suite.new
|
60
|
+
context_class = Factory.context_class
|
61
|
+
@suite[context_class] = [
|
62
|
+
Factory.test("should do nothing", context_class),
|
63
|
+
Factory.test("should pass", context_class) do
|
64
|
+
assert(1==1)
|
65
|
+
refute(1==0)
|
66
|
+
end,
|
67
|
+
Factory.test("should fail", context_class) do
|
68
|
+
ignore
|
69
|
+
assert(1==0)
|
70
|
+
refute(1==1)
|
71
|
+
end,
|
72
|
+
Factory.test("should be ignored", context_class) do
|
73
|
+
ignore
|
74
|
+
end,
|
75
|
+
Factory.test("should skip", context_class) do
|
76
|
+
skip
|
77
|
+
ignore
|
78
|
+
assert(1==1)
|
79
|
+
end,
|
80
|
+
Factory.test("should error", context_class) do
|
81
|
+
raise Exception
|
82
|
+
ignore
|
83
|
+
assert(1==1)
|
84
|
+
end
|
85
|
+
]
|
86
|
+
@suite.tests.each(&:run)
|
87
|
+
end
|
88
|
+
subject{ @suite }
|
89
|
+
|
90
|
+
should "know how many tests it has" do
|
91
|
+
assert_equal 6, subject.test_count
|
92
|
+
end
|
93
|
+
|
94
|
+
should "know its ordered tests" do
|
95
|
+
assert_equal subject.test_count, subject.ordered_tests.size
|
96
|
+
end
|
97
|
+
|
98
|
+
should "know how many results it has" do
|
99
|
+
assert_equal 8, subject.result_count
|
100
|
+
end
|
101
|
+
|
102
|
+
should "know its ordered results" do
|
103
|
+
assert_equal subject.test_count, subject.ordered_tests.size
|
104
|
+
end
|
105
|
+
|
106
|
+
should "know how many pass results it has" do
|
107
|
+
assert_equal 2, subject.result_count(:pass)
|
108
|
+
end
|
109
|
+
|
110
|
+
should "know how many fail results it has" do
|
111
|
+
assert_equal 2, subject.result_count(:fail)
|
112
|
+
end
|
113
|
+
|
114
|
+
should "know how many ignore results it has" do
|
115
|
+
assert_equal 2, subject.result_count(:ignore)
|
116
|
+
end
|
117
|
+
|
118
|
+
should "know how many skip results it has" do
|
119
|
+
assert_equal 1, subject.result_count(:skip)
|
120
|
+
end
|
121
|
+
|
122
|
+
should "know how many error results it has" do
|
123
|
+
assert_equal 1, subject.result_count(:error)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
class CountTest < WithTestsTest
|
129
|
+
|
130
|
+
should "count its tests" do
|
131
|
+
assert_equal subject.test_count, subject.count(:tests)
|
132
|
+
end
|
133
|
+
|
134
|
+
should "count its results" do
|
135
|
+
assert_equal subject.result_count, subject.count(:results)
|
136
|
+
end
|
137
|
+
|
138
|
+
should "count its passed results" do
|
139
|
+
assert_equal subject.result_count(:pass), subject.count(:passed)
|
140
|
+
assert_equal subject.result_count(:pass), subject.count(:pass)
|
141
|
+
end
|
142
|
+
|
143
|
+
should "count its failed results" do
|
144
|
+
assert_equal subject.result_count(:fail), subject.count(:failed)
|
145
|
+
assert_equal subject.result_count(:fail), subject.count(:fail)
|
146
|
+
end
|
147
|
+
|
148
|
+
should "count its ignored results" do
|
149
|
+
assert_equal subject.result_count(:ignore), subject.count(:ignored)
|
150
|
+
assert_equal subject.result_count(:ignore), subject.count(:ignore)
|
151
|
+
end
|
152
|
+
|
153
|
+
should "count its skipped results" do
|
154
|
+
assert_equal subject.result_count(:skip), subject.count(:skipped)
|
155
|
+
assert_equal subject.result_count(:skip), subject.count(:skip)
|
156
|
+
end
|
157
|
+
|
158
|
+
should "count its errored results" do
|
159
|
+
assert_equal subject.result_count(:error), subject.count(:errored)
|
160
|
+
assert_equal subject.result_count(:error), subject.count(:error)
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
class TestsTest < WithTestsTest
|
167
|
+
|
168
|
+
should "build test instances to run" do
|
169
|
+
assert_kind_of Assert::Test, subject.tests.first
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
class PrepTest < Assert::Context
|
176
|
+
desc "a suite with a context with local public test meths"
|
177
|
+
setup do
|
178
|
+
@suite = Assert::Suite.new
|
179
|
+
@suite << TwoTests
|
180
|
+
end
|
181
|
+
subject{ @suite }
|
182
|
+
|
183
|
+
should "create tests from any local public test methods with a prep call" do
|
184
|
+
subject.send(:prep)
|
185
|
+
assert_equal 2, subject.test_count(TwoTests)
|
186
|
+
end
|
187
|
+
|
188
|
+
should "not double count local public test methods with multiple prep calls" do
|
189
|
+
subject.send(:prep)
|
190
|
+
subject.send(:prep)
|
191
|
+
assert_equal 2, subject.test_count(TwoTests)
|
192
|
+
end
|
193
|
+
|
194
|
+
should "create tests from any local public test methods with a test_count call" do
|
195
|
+
assert_equal 2, subject.test_count(TwoTests)
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|