kintama 0.1.9 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -2
- data/lib/kintama.rb +26 -12
- data/lib/kintama/assertions.rb +40 -1
- data/lib/kintama/context.rb +65 -50
- data/lib/kintama/mocha.rb +32 -10
- data/lib/kintama/no_conflict.rb +2 -0
- data/lib/kintama/reporter.rb +11 -10
- data/lib/kintama/runnable.rb +2 -2
- data/lib/kintama/runner.rb +5 -5
- data/lib/kintama/test.rb +2 -2
- data/test/integration/automatic_running_test.rb +22 -0
- data/test/integration/line_based_running_test.rb +129 -0
- data/test/reporters/base_reporter_test.rb +31 -101
- data/test/reporters/inline_reporter_test.rb +23 -35
- data/test/reporters/verbose_reporter_test.rb +78 -76
- data/test/test_helper.rb +159 -2
- data/test/{assertions_test.rb → unit/assertions_test.rb} +54 -5
- data/test/unit/context_test.rb +15 -0
- data/test/unit/runner_test.rb +87 -0
- data/test/{test_and_subcontext_access_test.rb → unit/test_and_subcontext_access_test.rb} +6 -33
- data/test/usage/01_basic_usage_test.rb +131 -0
- data/test/usage/02_setup_test.rb +98 -0
- data/test/usage/03_teardown_test.rb +121 -0
- data/test/usage/04_pending_tests_test.rb +16 -0
- data/test/usage/05_aliases_test.rb +73 -0
- data/test/usage/06_defining_methods_in_tests_test.rb +202 -0
- data/test/usage/07_exceptions_test.rb +42 -0
- data/test/usage/08_start_and_finish_test.rb +261 -0
- data/test/usage/09_expectations_and_mocking_test.rb +85 -0
- data/test/usage/10_let_and_subject_test.rb +134 -0
- data/test/usage/11_matcher_test.rb +148 -0
- data/test/usage/12_action_test.rb +118 -0
- metadata +55 -48
- data/test/aliases_test.rb +0 -26
- data/test/automatic_running_test.rb +0 -45
- data/test/exceptions_test.rb +0 -40
- data/test/kintama_test.rb +0 -114
- data/test/line_based_running_test.rb +0 -143
- data/test/matcher_test.rb +0 -80
- data/test/method_behaviour_test.rb +0 -176
- data/test/pending_test_and_context.rb +0 -20
- data/test/setup_test.rb +0 -107
- data/test/start_and_finish_test.rb +0 -94
- data/test/teardown_test.rb +0 -106
data/test/teardown_test.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TeardownTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_should_run_teardown_after_the_test_finishes
|
6
|
-
$called = false
|
7
|
-
x = context "Given a teardown" do
|
8
|
-
teardown do
|
9
|
-
raise "Argh" unless @result == 123
|
10
|
-
$called = true
|
11
|
-
end
|
12
|
-
should "run teardown after this test" do
|
13
|
-
@result = 123
|
14
|
-
end
|
15
|
-
end
|
16
|
-
x.run
|
17
|
-
assert x.passed?
|
18
|
-
assert $called
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_should_run_all_teardowns_in_proximity_of_nesting_order_after_a_nested_test_finishes
|
22
|
-
$called = false
|
23
|
-
x = context "Given a teardown" do
|
24
|
-
teardown do
|
25
|
-
raise "Argh" unless @result == 123
|
26
|
-
$called = true
|
27
|
-
end
|
28
|
-
context "with a subcontext with another teardown" do
|
29
|
-
teardown do
|
30
|
-
raise "Oh no" unless @result == 456
|
31
|
-
@result = 123
|
32
|
-
end
|
33
|
-
should "run teardown after this test" do
|
34
|
-
@result = 456
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
x.run
|
39
|
-
assert x.passed?
|
40
|
-
assert $called
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_should_run_teardown_defined_on_kintama_itself_after_other_teardowns
|
44
|
-
ran = false
|
45
|
-
Kintama.teardown do
|
46
|
-
ran = true
|
47
|
-
assert_equal 'blah', @thing
|
48
|
-
end
|
49
|
-
c = context "Given a context" do
|
50
|
-
should "have run the setup defined in the default behaviour" do
|
51
|
-
# nothing
|
52
|
-
end
|
53
|
-
teardown do
|
54
|
-
@thing = 'blah'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
c.run
|
58
|
-
assert c.passed?, "@thing was not redefined!"
|
59
|
-
assert ran
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_should_allow_multiple_teardowns_to_be_registered
|
63
|
-
Kintama.teardown do
|
64
|
-
$ran = 1
|
65
|
-
end
|
66
|
-
Kintama.teardown do
|
67
|
-
$ran += 1
|
68
|
-
end
|
69
|
-
c = context "Given multiple setups" do
|
70
|
-
should "run them all" do
|
71
|
-
assert true
|
72
|
-
end
|
73
|
-
end
|
74
|
-
c.run
|
75
|
-
assert_equal 2, $ran, "both teardowns didn't run"
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_should_run_teardowns_even_after_exceptions
|
79
|
-
ran = false
|
80
|
-
c = context "Given a test that fails" do
|
81
|
-
should "still run teardown" do
|
82
|
-
raise "argh"
|
83
|
-
end
|
84
|
-
teardown do
|
85
|
-
ran = true
|
86
|
-
end
|
87
|
-
end
|
88
|
-
c.run
|
89
|
-
assert !c.passed?
|
90
|
-
assert ran
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_should_not_mask_exceptions_in_tests_with_ones_in_teardown
|
94
|
-
c = context "Given a test that fails" do
|
95
|
-
should "report this error" do
|
96
|
-
raise "this"
|
97
|
-
end
|
98
|
-
teardown do
|
99
|
-
raise "that"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
c.run
|
103
|
-
assert !c.passed?
|
104
|
-
assert_equal "this", c.failures.first.failure.to_s
|
105
|
-
end
|
106
|
-
end
|