assert 2.18.3 → 2.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assert/context.rb +5 -2
- data/lib/assert/context/let_dsl.rb +3 -3
- data/lib/assert/context/subject_dsl.rb +23 -24
- data/lib/assert/version.rb +1 -1
- data/test/system/stub_tests.rb +101 -117
- data/test/system/test_tests.rb +21 -33
- data/test/unit/assert_tests.rb +3 -1
- data/test/unit/assertions/assert_block_tests.rb +6 -8
- data/test/unit/assertions/assert_empty_tests.rb +10 -12
- data/test/unit/assertions/assert_equal_tests.rb +12 -18
- data/test/unit/assertions/assert_file_exists_tests.rb +10 -12
- data/test/unit/assertions/assert_includes_tests.rb +10 -12
- data/test/unit/assertions/assert_instance_of_tests.rb +10 -12
- data/test/unit/assertions/assert_kind_of_tests.rb +10 -12
- data/test/unit/assertions/assert_match_tests.rb +10 -12
- data/test/unit/assertions/assert_nil_tests.rb +10 -12
- data/test/unit/assertions/assert_raises_tests.rb +6 -8
- data/test/unit/assertions/assert_respond_to_tests.rb +10 -12
- data/test/unit/assertions/assert_same_tests.rb +16 -22
- data/test/unit/assertions/assert_true_false_tests.rb +20 -24
- data/test/unit/assertions_tests.rb +1 -2
- data/test/unit/config_helpers_tests.rb +8 -4
- data/test/unit/config_tests.rb +7 -2
- data/test/unit/context/setup_dsl_tests.rb +3 -3
- data/test/unit/context/subject_dsl_tests.rb +1 -2
- data/test/unit/context/suite_dsl_tests.rb +1 -2
- data/test/unit/context_info_tests.rb +9 -2
- data/test/unit/context_tests.rb +65 -73
- data/test/unit/default_suite_tests.rb +8 -2
- data/test/unit/factory_tests.rb +3 -1
- data/test/unit/file_line_tests.rb +8 -8
- data/test/unit/macro_tests.rb +10 -5
- data/test/unit/result_tests.rb +34 -45
- data/test/unit/runner_tests.rb +10 -10
- data/test/unit/suite_tests.rb +9 -9
- data/test/unit/test_tests.rb +32 -39
- data/test/unit/utils_tests.rb +3 -1
- data/test/unit/view_helpers_tests.rb +6 -7
- data/test/unit/view_tests.rb +4 -3
- metadata +2 -2
@@ -4,7 +4,9 @@ require "assert/file_line"
|
|
4
4
|
class Assert::FileLine
|
5
5
|
class UnitTests < Assert::Context
|
6
6
|
desc "Assert::FileLine"
|
7
|
-
subject {
|
7
|
+
subject { unit_class }
|
8
|
+
|
9
|
+
let(:unit_class) { Assert::FileLine }
|
8
10
|
|
9
11
|
let(:file1) { "#{Factory.path}_tests.rb" }
|
10
12
|
let(:line1) { Factory.integer.to_s }
|
@@ -43,9 +45,7 @@ class Assert::FileLine
|
|
43
45
|
|
44
46
|
class InitTests < UnitTests
|
45
47
|
desc "when init"
|
46
|
-
subject {
|
47
|
-
|
48
|
-
let(:file_line1) { Assert::FileLine.new(file1, line1) }
|
48
|
+
subject { unit_class.new(file1, line1) }
|
49
49
|
|
50
50
|
should have_readers :file, :line
|
51
51
|
|
@@ -53,11 +53,11 @@ class Assert::FileLine
|
|
53
53
|
assert_that(subject.file).equals(file1)
|
54
54
|
assert_that(subject.line).equals(line1)
|
55
55
|
|
56
|
-
file_line =
|
56
|
+
file_line = unit_class.new(file1)
|
57
57
|
assert_that(file_line.file).equals(file1)
|
58
58
|
assert_that(file_line.line).equals("")
|
59
59
|
|
60
|
-
file_line =
|
60
|
+
file_line = unit_class.new
|
61
61
|
assert_that(file_line.file).equals("")
|
62
62
|
assert_that(file_line.line).equals("")
|
63
63
|
end
|
@@ -67,8 +67,8 @@ class Assert::FileLine
|
|
67
67
|
end
|
68
68
|
|
69
69
|
should "know if it is equal to another file line" do
|
70
|
-
yes =
|
71
|
-
no =
|
70
|
+
yes = unit_class.new(file1, line1)
|
71
|
+
no = unit_class.new("#{Factory.path}_tests.rb", Factory.integer.to_s)
|
72
72
|
|
73
73
|
assert_that(subject).equals(yes)
|
74
74
|
assert_not_equal no, subject
|
data/test/unit/macro_tests.rb
CHANGED
@@ -4,9 +4,14 @@ require "assert/macro"
|
|
4
4
|
class Assert::Macro
|
5
5
|
class UnitTests < Assert::Context
|
6
6
|
desc "Assert::Macro"
|
7
|
-
subject {
|
7
|
+
subject { unit_class }
|
8
8
|
|
9
|
-
let(:
|
9
|
+
let(:unit_class) { Assert::Macro }
|
10
|
+
end
|
11
|
+
|
12
|
+
class InitTests < UnitTests
|
13
|
+
desc "when init"
|
14
|
+
subject { unit_class.new {} }
|
10
15
|
|
11
16
|
should "have an accessor for its (optional) name" do
|
12
17
|
assert_that(subject).responds_to(:name)
|
@@ -14,11 +19,11 @@ class Assert::Macro
|
|
14
19
|
end
|
15
20
|
|
16
21
|
should "default its name if no given" do
|
17
|
-
assert_that((
|
22
|
+
assert_that((unit_class.new {}).name).equals("run this macro")
|
18
23
|
end
|
19
24
|
|
20
25
|
should "initialize with a given name" do
|
21
|
-
assert_that((
|
26
|
+
assert_that((unit_class.new("test") {}).name).equals("test")
|
22
27
|
end
|
23
28
|
|
24
29
|
should "be a Proc" do
|
@@ -26,7 +31,7 @@ class Assert::Macro
|
|
26
31
|
end
|
27
32
|
|
28
33
|
should "complain if you create a macro without a block" do
|
29
|
-
assert_that(-> {
|
34
|
+
assert_that(-> { unit_class.new }).raises(ArgumentError)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
data/test/unit/result_tests.rb
CHANGED
@@ -6,7 +6,9 @@ require "assert/file_line"
|
|
6
6
|
module Assert::Result
|
7
7
|
class UnitTests < Assert::Context
|
8
8
|
desc "Assert::Result"
|
9
|
-
subject {
|
9
|
+
subject { unit_class }
|
10
|
+
|
11
|
+
let(:unit_class) { Assert::Result }
|
10
12
|
|
11
13
|
let(:test1) { Factory.test("a test name") }
|
12
14
|
|
@@ -32,9 +34,9 @@ module Assert::Result
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
class
|
36
|
-
desc "Base"
|
37
|
-
subject {
|
37
|
+
class InitBaseTests < UnitTests
|
38
|
+
desc "Base when init"
|
39
|
+
subject { Base.new(given_data1) }
|
38
40
|
|
39
41
|
let(:given_data1) {
|
40
42
|
{
|
@@ -47,7 +49,6 @@ module Assert::Result
|
|
47
49
|
:backtrace => Backtrace.new(Factory.backtrace)
|
48
50
|
}
|
49
51
|
}
|
50
|
-
let(:result1) { Base.new(given_data1) }
|
51
52
|
|
52
53
|
should have_cmeths :type, :name, :for_test
|
53
54
|
should have_imeths :type, :name, :test_name, :test_file_line
|
@@ -226,11 +227,9 @@ module Assert::Result
|
|
226
227
|
end
|
227
228
|
end
|
228
229
|
|
229
|
-
class
|
230
|
-
desc "Pass"
|
231
|
-
subject {
|
232
|
-
|
233
|
-
let(:result1) { Pass.new({}) }
|
230
|
+
class InitPassTests < UnitTests
|
231
|
+
desc "Pass when init"
|
232
|
+
subject { Pass.new({}) }
|
234
233
|
|
235
234
|
should "know its type/name" do
|
236
235
|
assert_that(subject.type).equals(:pass)
|
@@ -239,11 +238,9 @@ module Assert::Result
|
|
239
238
|
end
|
240
239
|
end
|
241
240
|
|
242
|
-
class
|
243
|
-
desc "Ignore"
|
244
|
-
subject {
|
245
|
-
|
246
|
-
let(:result1) { Ignore.new({}) }
|
241
|
+
class InitIgnoreTests < UnitTests
|
242
|
+
desc "Ignore when init"
|
243
|
+
subject { Ignore.new({}) }
|
247
244
|
|
248
245
|
should "know its type/name" do
|
249
246
|
assert_that(subject.type).equals(:ignore)
|
@@ -252,8 +249,8 @@ module Assert::Result
|
|
252
249
|
end
|
253
250
|
end
|
254
251
|
|
255
|
-
class
|
256
|
-
desc "HaltingTestResultError"
|
252
|
+
class InitHaltingTestResultErrorTests < UnitTests
|
253
|
+
desc "HaltingTestResultError when init"
|
257
254
|
subject { HaltingTestResultError.new }
|
258
255
|
|
259
256
|
should have_accessors :assert_with_bt
|
@@ -263,20 +260,18 @@ module Assert::Result
|
|
263
260
|
end
|
264
261
|
end
|
265
262
|
|
266
|
-
class
|
267
|
-
desc "TestFailure"
|
268
|
-
subject { TestFailure }
|
263
|
+
class InitTestFailureTests < UnitTests
|
264
|
+
desc "TestFailure when init"
|
265
|
+
subject { TestFailure.new }
|
269
266
|
|
270
267
|
should "be a halting test result error" do
|
271
|
-
assert_that(subject
|
268
|
+
assert_that(subject).is_kind_of(HaltingTestResultError)
|
272
269
|
end
|
273
270
|
end
|
274
271
|
|
275
|
-
class
|
276
|
-
desc "Fail"
|
277
|
-
subject {
|
278
|
-
|
279
|
-
let(:result1) { Fail.new({}) }
|
272
|
+
class InitFailTests < UnitTests
|
273
|
+
desc "Fail when init"
|
274
|
+
subject { Fail.new({}) }
|
280
275
|
|
281
276
|
should "know its type/name" do
|
282
277
|
assert_that(subject.type).equals(:fail)
|
@@ -311,20 +306,18 @@ module Assert::Result
|
|
311
306
|
end
|
312
307
|
end
|
313
308
|
|
314
|
-
class
|
315
|
-
desc "TestSkipped"
|
316
|
-
subject { TestSkipped }
|
309
|
+
class InitTestSkippedTests < UnitTests
|
310
|
+
desc "TestSkipped when init"
|
311
|
+
subject { TestSkipped.new }
|
317
312
|
|
318
313
|
should "be a halting test result error" do
|
319
|
-
assert_that(subject
|
314
|
+
assert_that(subject).is_kind_of(HaltingTestResultError)
|
320
315
|
end
|
321
316
|
end
|
322
317
|
|
323
|
-
class
|
324
|
-
desc "Skip"
|
325
|
-
subject {
|
326
|
-
|
327
|
-
let(:result1) { Skip.new({}) }
|
318
|
+
class InitSkipTests < UnitTests
|
319
|
+
desc "Skip when init"
|
320
|
+
subject { Skip.new({}) }
|
328
321
|
|
329
322
|
should "know its type/name" do
|
330
323
|
assert_that(subject.type).equals(:skip)
|
@@ -359,11 +352,9 @@ module Assert::Result
|
|
359
352
|
end
|
360
353
|
end
|
361
354
|
|
362
|
-
class
|
363
|
-
desc "Error"
|
364
|
-
subject {
|
365
|
-
|
366
|
-
let(:result1) { Error.new({}) }
|
355
|
+
class InitErrorTests < UnitTests
|
356
|
+
desc "Error when init"
|
357
|
+
subject { Error.new({}) }
|
367
358
|
|
368
359
|
should "know its class-level type/name" do
|
369
360
|
assert_that(subject.class.type).equals(:error)
|
@@ -388,11 +379,9 @@ module Assert::Result
|
|
388
379
|
end
|
389
380
|
end
|
390
381
|
|
391
|
-
class
|
392
|
-
desc "Backtrace"
|
393
|
-
subject {
|
394
|
-
|
395
|
-
let(:backtrace1) { Backtrace.new(Factory.backtrace) }
|
382
|
+
class InitBacktraceTests < UnitTests
|
383
|
+
desc "Backtrace when init"
|
384
|
+
subject { Backtrace.new(Factory.backtrace) }
|
396
385
|
|
397
386
|
should have_cmeths :parse, :to_s
|
398
387
|
should have_imeths :filtered
|
data/test/unit/runner_tests.rb
CHANGED
@@ -10,7 +10,9 @@ require "assert/view"
|
|
10
10
|
class Assert::Runner
|
11
11
|
class UnitTests < Assert::Context
|
12
12
|
desc "Assert::Runner"
|
13
|
-
subject {
|
13
|
+
subject { unit_class }
|
14
|
+
|
15
|
+
let(:unit_class) { Assert::Runner }
|
14
16
|
|
15
17
|
should "include the config helpers" do
|
16
18
|
assert_that(subject).includes(Assert::ConfigHelpers)
|
@@ -19,7 +21,7 @@ class Assert::Runner
|
|
19
21
|
|
20
22
|
class InitTests < UnitTests
|
21
23
|
desc "when init"
|
22
|
-
subject {
|
24
|
+
subject { unit_class.new(config1) }
|
23
25
|
|
24
26
|
setup do
|
25
27
|
config1.suite Assert::DefaultSuite.new(config1)
|
@@ -27,7 +29,6 @@ class Assert::Runner
|
|
27
29
|
end
|
28
30
|
|
29
31
|
let(:config1) { Factory.modes_off_config }
|
30
|
-
let(:runner1) { Assert::Runner.new(config1) }
|
31
32
|
|
32
33
|
should have_readers :config
|
33
34
|
should have_imeths :runner, :run
|
@@ -46,6 +47,7 @@ class Assert::Runner
|
|
46
47
|
|
47
48
|
class RunTests < InitTests
|
48
49
|
desc "and run"
|
50
|
+
subject { runner_class1.new(config1) }
|
49
51
|
|
50
52
|
setup do
|
51
53
|
@view_output = ""
|
@@ -57,26 +59,24 @@ class Assert::Runner
|
|
57
59
|
config1.view view_class.new(config1, StringIO.new(@view_output, "w+"))
|
58
60
|
config1.suite.on_test(test1)
|
59
61
|
|
60
|
-
@
|
62
|
+
@result_count = subject.run
|
61
63
|
end
|
62
64
|
|
63
|
-
let(:runner_class1) { Class.new(
|
65
|
+
let(:runner_class1) { Class.new(unit_class) { include CallbackMixin } }
|
64
66
|
let(:ci1) { Factory.context_info(Factory.modes_off_context_class) }
|
65
67
|
let(:test1) { Factory.test("should pass", ci1){ assert(1==1) } }
|
66
|
-
let(:runner1) { runner_class1.new(config1) }
|
67
68
|
|
68
69
|
should "return the fail+error result count as an integer exit code" do
|
69
|
-
assert_that(@
|
70
|
+
assert_that(@result_count).equals(0)
|
70
71
|
|
71
72
|
fail_count = Factory.integer
|
72
73
|
error_count = Factory.integer
|
73
74
|
Assert.stub(subject, :fail_result_count){ fail_count }
|
74
75
|
Assert.stub(subject, :error_result_count){ error_count }
|
75
76
|
Assert.stub(test1, :run){ } # no-op
|
76
|
-
|
77
|
+
result_count = subject.run
|
77
78
|
|
78
|
-
|
79
|
-
assert_that(result).equals(exp)
|
79
|
+
assert_that(result_count).equals(fail_count + error_count)
|
80
80
|
end
|
81
81
|
|
82
82
|
should "run all callbacks on itself, the suite and the view" do
|
data/test/unit/suite_tests.rb
CHANGED
@@ -6,10 +6,11 @@ require "assert/test"
|
|
6
6
|
require "test/support/inherited_stuff"
|
7
7
|
|
8
8
|
class Assert::Suite
|
9
|
-
|
10
9
|
class UnitTests < Assert::Context
|
11
10
|
desc "Assert::Suite"
|
12
|
-
subject {
|
11
|
+
subject { unit_class }
|
12
|
+
|
13
|
+
let(:unit_class) { Assert::Suite }
|
13
14
|
|
14
15
|
should "include the config helpers" do
|
15
16
|
assert_that(subject).includes(Assert::ConfigHelpers)
|
@@ -23,10 +24,9 @@ class Assert::Suite
|
|
23
24
|
|
24
25
|
class InitTests < UnitTests
|
25
26
|
desc "when init"
|
26
|
-
subject {
|
27
|
+
subject { unit_class.new(config1) }
|
27
28
|
|
28
29
|
let(:config1) { Factory.modes_off_config }
|
29
|
-
let(:suite1) { Assert::Suite.new(config1) }
|
30
30
|
|
31
31
|
should have_readers :config, :test_methods, :setups, :teardowns
|
32
32
|
should have_accessors :start_time, :end_time
|
@@ -84,8 +84,8 @@ class Assert::Suite
|
|
84
84
|
|
85
85
|
should "add setup procs" do
|
86
86
|
status = nil
|
87
|
-
|
88
|
-
|
87
|
+
subject.setup{ status = "setups" }
|
88
|
+
subject.startup{ status += " have been run" }
|
89
89
|
|
90
90
|
assert_that(subject.setups.count).equals(2)
|
91
91
|
subject.setups.each(&:call)
|
@@ -94,8 +94,8 @@ class Assert::Suite
|
|
94
94
|
|
95
95
|
should "add teardown procs" do
|
96
96
|
status = nil
|
97
|
-
|
98
|
-
|
97
|
+
subject.teardown{ status = "teardowns" }
|
98
|
+
subject.shutdown{ status += " have been run" }
|
99
99
|
|
100
100
|
assert_that(subject.teardowns.count).equals(2)
|
101
101
|
subject.teardowns.each(&:call)
|
@@ -107,7 +107,7 @@ class Assert::Suite
|
|
107
107
|
desc "with tests loaded"
|
108
108
|
|
109
109
|
setup do
|
110
|
-
tests1.each{ |test|
|
110
|
+
tests1.each{ |test| subject.on_test(test) }
|
111
111
|
end
|
112
112
|
|
113
113
|
let(:ci1) { proc{ Factory.context_info(Factory.modes_off_context_class) } }
|
data/test/unit/test_tests.rb
CHANGED
@@ -8,7 +8,9 @@ require "assert/result"
|
|
8
8
|
class Assert::Test
|
9
9
|
class UnitTests < Assert::Context
|
10
10
|
desc "Assert::Test"
|
11
|
-
subject {
|
11
|
+
subject { unit_class }
|
12
|
+
|
13
|
+
let(:unit_class) { Assert::Test }
|
12
14
|
|
13
15
|
let(:context_class1) { Factory.modes_off_context_class { desc "context class" } }
|
14
16
|
let(:context_info1) { Factory.context_info(context_class1) }
|
@@ -68,7 +70,7 @@ class Assert::Test
|
|
68
70
|
|
69
71
|
class InitWithDataTests < UnitTests
|
70
72
|
desc "when init with data"
|
71
|
-
subject {
|
73
|
+
subject { unit_class.new(meta_data1.merge(run_data1)) }
|
72
74
|
|
73
75
|
let(:file_line1) { Assert::FileLine.new(Factory.string, Factory.integer.to_s) }
|
74
76
|
let(:meta_data1) {
|
@@ -86,7 +88,6 @@ class Assert::Test
|
|
86
88
|
:code => test_code1
|
87
89
|
}
|
88
90
|
}
|
89
|
-
let(:test1) { Assert::Test.new(meta_data1.merge(run_data1)) }
|
90
91
|
|
91
92
|
should have_imeths :file_line, :file_name, :line_num
|
92
93
|
should have_imeths :name, :output, :run_time
|
@@ -104,7 +105,7 @@ class Assert::Test
|
|
104
105
|
end
|
105
106
|
|
106
107
|
should "default its attrs" do
|
107
|
-
test =
|
108
|
+
test = unit_class.new
|
108
109
|
|
109
110
|
assert_that(test.file_line).equals(Assert::FileLine.parse(""))
|
110
111
|
assert_that(test.name).equals("")
|
@@ -137,7 +138,13 @@ class Assert::Test
|
|
137
138
|
class PassFailIgnoreHandlingTests < UnitTests
|
138
139
|
include Assert::Test::TestHelpers
|
139
140
|
|
140
|
-
subject {
|
141
|
+
subject {
|
142
|
+
Factory.test("pass fail ignore test", context_info1) do
|
143
|
+
ignore("something")
|
144
|
+
assert(true)
|
145
|
+
assert(false)
|
146
|
+
end
|
147
|
+
}
|
141
148
|
|
142
149
|
setup do
|
143
150
|
subject.context_class.setup do
|
@@ -153,14 +160,6 @@ class Assert::Test
|
|
153
160
|
subject.run(&test_run_callback)
|
154
161
|
end
|
155
162
|
|
156
|
-
let(:test1) {
|
157
|
-
Factory.test("pass fail ignore test", context_info1) do
|
158
|
-
ignore("something")
|
159
|
-
assert(true)
|
160
|
-
assert(false)
|
161
|
-
end
|
162
|
-
}
|
163
|
-
|
164
163
|
should "capture results in the test and any setups/teardowns" do
|
165
164
|
assert_that(test_run_results.size).equals(9)
|
166
165
|
test_run_results.each do |result|
|
@@ -336,70 +335,64 @@ class Assert::Test
|
|
336
335
|
|
337
336
|
class ComparingTests < UnitTests
|
338
337
|
desc "<=> another test"
|
339
|
-
subject {
|
340
|
-
|
341
|
-
let(:test1) { Factory.test("mmm") }
|
338
|
+
subject { Factory.test("mmm") }
|
342
339
|
|
343
340
|
should "return 1 with a test named 'aaa' (greater than it)" do
|
344
|
-
|
345
|
-
assert_that(result).equals(1)
|
341
|
+
assert_that(subject <=> Factory.test("aaa")).equals(1)
|
346
342
|
end
|
347
343
|
|
348
344
|
should "return 0 with a test named the same" do
|
349
|
-
|
350
|
-
assert_that(result).equals(0)
|
345
|
+
assert_that(subject <=> Factory.test(subject.name)).equals(0)
|
351
346
|
end
|
352
347
|
|
353
348
|
should "return -1 with a test named 'zzz' (less than it)" do
|
354
|
-
|
355
|
-
assert_that(result).equals(-1)
|
349
|
+
assert_that(subject <=> Factory.test("zzz")).equals(-1)
|
356
350
|
end
|
357
351
|
end
|
358
352
|
|
359
353
|
class CaptureOutTests < UnitTests
|
360
354
|
desc "when capturing std out"
|
361
|
-
|
362
|
-
let(:capture_config1) { Assert::Config.new(:capture_output => true) }
|
363
|
-
let(:test1) {
|
355
|
+
subject {
|
364
356
|
Factory.test("stdout", capture_config1) do
|
365
357
|
puts "std out from the test"
|
366
358
|
assert true
|
367
359
|
end
|
368
360
|
}
|
369
361
|
|
362
|
+
let(:capture_config1) { Assert::Config.new(:capture_output => true) }
|
363
|
+
|
370
364
|
should "capture any io from the test" do
|
371
|
-
|
372
|
-
assert_that(
|
365
|
+
subject.run
|
366
|
+
assert_that(subject.output).equals("std out from the test\n")
|
373
367
|
end
|
374
368
|
end
|
375
369
|
|
376
370
|
class FullCaptureOutTests < CaptureOutTests
|
377
371
|
desc "across setup, teardown, and meth calls"
|
378
|
-
|
379
|
-
setup do
|
380
|
-
test1.context_class.setup{ puts "std out from the setup" }
|
381
|
-
test1.context_class.teardown{ puts "std out from the teardown" }
|
382
|
-
test1.context_class.send(:define_method, "a_method_an_assert_calls") do
|
383
|
-
puts "std out from a method an assert called"
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
let(:test1) {
|
372
|
+
subject {
|
388
373
|
Factory.test("fullstdouttest", capture_config1) do
|
389
374
|
puts "std out from the test"
|
390
375
|
assert a_method_an_assert_calls
|
391
376
|
end
|
392
377
|
}
|
393
378
|
|
379
|
+
setup do
|
380
|
+
subject.context_class.setup{ puts "std out from the setup" }
|
381
|
+
subject.context_class.teardown{ puts "std out from the teardown" }
|
382
|
+
subject.context_class.send(:define_method, "a_method_an_assert_calls") do
|
383
|
+
puts "std out from a method an assert called"
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
394
387
|
should "collect all stdout in the output accessor" do
|
395
|
-
|
388
|
+
subject.run
|
396
389
|
|
397
390
|
exp_out =
|
398
391
|
"std out from the setup\n"\
|
399
392
|
"std out from the test\n"\
|
400
393
|
"std out from a method an assert called\n"\
|
401
394
|
"std out from the teardown\n"
|
402
|
-
assert_that(
|
395
|
+
assert_that(subject.output).equals(exp_out)
|
403
396
|
end
|
404
397
|
end
|
405
398
|
end
|