riot 0.12.1 → 0.12.2
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 +10 -0
- data/.yardopts +6 -0
- data/CHANGELOG +58 -46
- data/Gemfile +4 -0
- data/README.markdown +322 -85
- data/Rakefile +3 -38
- data/lib/riot.rb +74 -11
- data/lib/riot/assertion.rb +32 -1
- data/lib/riot/assertion_macro.rb +57 -10
- data/lib/riot/assertion_macros/any.rb +4 -2
- data/lib/riot/assertion_macros/assigns.rb +18 -4
- data/lib/riot/assertion_macros/empty.rb +2 -0
- data/lib/riot/assertion_macros/equals.rb +4 -0
- data/lib/riot/assertion_macros/equivalent_to.rb +5 -1
- data/lib/riot/assertion_macros/exists.rb +4 -2
- data/lib/riot/assertion_macros/includes.rb +5 -1
- data/lib/riot/assertion_macros/kind_of.rb +5 -1
- data/lib/riot/assertion_macros/matches.rb +5 -1
- data/lib/riot/assertion_macros/nil.rb +3 -1
- data/lib/riot/assertion_macros/not_borat.rb +6 -0
- data/lib/riot/assertion_macros/raises.rb +13 -7
- data/lib/riot/assertion_macros/respond_to.rb +5 -1
- data/lib/riot/assertion_macros/same_elements.rb +6 -2
- data/lib/riot/assertion_macros/size.rb +5 -1
- data/lib/riot/context.rb +58 -10
- data/lib/riot/context_helpers.rb +20 -4
- data/lib/riot/context_options.rb +14 -4
- data/lib/riot/message.rb +87 -6
- data/lib/riot/middleware.rb +69 -4
- data/lib/riot/reporter.rb +71 -110
- data/lib/riot/reporter/dot_matrix.rb +49 -0
- data/lib/riot/reporter/io.rb +85 -0
- data/lib/riot/reporter/pretty_dot_matrix.rb +38 -0
- data/lib/riot/reporter/silent.rb +18 -0
- data/lib/riot/reporter/story.rb +52 -0
- data/lib/riot/rr.rb +28 -4
- data/lib/riot/runnable.rb +53 -0
- data/lib/riot/situation.rb +45 -0
- data/lib/riot/version.rb +4 -0
- data/riot.gemspec +14 -155
- data/test/core/assertion_macros/any_test.rb +10 -10
- data/test/core/assertion_macros/assigns_test.rb +7 -7
- data/test/core/assertion_macros/equivalent_to_test.rb +3 -3
- data/test/core/assertion_macros/exists_test.rb +4 -4
- data/test/core/assertion_macros/includes_test.rb +2 -2
- data/test/core/assertion_macros/kind_of_test.rb +3 -3
- data/test/core/assertion_macros/matches_test.rb +2 -2
- data/test/core/assertion_macros/nil_test.rb +2 -2
- data/test/core/assertion_macros/raises_test.rb +10 -10
- data/test/core/assertion_macros/respond_to_test.rb +2 -2
- data/test/core/assertion_macros/same_elements_test.rb +4 -4
- data/test/core/assertion_macros/size_test.rb +6 -6
- data/test/core/context/asserts_with_arguments_test.rb +12 -0
- data/test/core/context/using_describe_in_a_test.rb +1 -1
- data/test/core/report_test.rb +9 -5
- data/test/core/runnable/message_test.rb +10 -6
- data/test/teststrap.rb +0 -6
- metadata +20 -33
- data/TODO.markdown +0 -14
- data/VERSION +0 -1
- data/test.watchr +0 -70
- data/test/benchmark/colorize.rb +0 -39
data/lib/riot/version.rb
ADDED
data/riot.gemspec
CHANGED
@@ -1,162 +1,21 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "riot/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.
|
16
|
-
"README.markdown"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"CHANGELOG",
|
20
|
-
"MIT-LICENSE",
|
21
|
-
"README.markdown",
|
22
|
-
"Rakefile",
|
23
|
-
"TODO.markdown",
|
24
|
-
"VERSION",
|
25
|
-
"lib/riot.rb",
|
26
|
-
"lib/riot/assertion.rb",
|
27
|
-
"lib/riot/assertion_macro.rb",
|
28
|
-
"lib/riot/assertion_macros/any.rb",
|
29
|
-
"lib/riot/assertion_macros/assigns.rb",
|
30
|
-
"lib/riot/assertion_macros/empty.rb",
|
31
|
-
"lib/riot/assertion_macros/equals.rb",
|
32
|
-
"lib/riot/assertion_macros/equivalent_to.rb",
|
33
|
-
"lib/riot/assertion_macros/exists.rb",
|
34
|
-
"lib/riot/assertion_macros/includes.rb",
|
35
|
-
"lib/riot/assertion_macros/kind_of.rb",
|
36
|
-
"lib/riot/assertion_macros/matches.rb",
|
37
|
-
"lib/riot/assertion_macros/nil.rb",
|
38
|
-
"lib/riot/assertion_macros/not_borat.rb",
|
39
|
-
"lib/riot/assertion_macros/raises.rb",
|
40
|
-
"lib/riot/assertion_macros/respond_to.rb",
|
41
|
-
"lib/riot/assertion_macros/same_elements.rb",
|
42
|
-
"lib/riot/assertion_macros/size.rb",
|
43
|
-
"lib/riot/context.rb",
|
44
|
-
"lib/riot/context_helpers.rb",
|
45
|
-
"lib/riot/context_options.rb",
|
46
|
-
"lib/riot/message.rb",
|
47
|
-
"lib/riot/middleware.rb",
|
48
|
-
"lib/riot/reporter.rb",
|
49
|
-
"lib/riot/rr.rb",
|
50
|
-
"lib/riot/runnable.rb",
|
51
|
-
"lib/riot/situation.rb",
|
52
|
-
"riot.gemspec",
|
53
|
-
"test.watchr",
|
54
|
-
"test/benchmark/colorize.rb",
|
55
|
-
"test/benchmark/message_concatenation.rb",
|
56
|
-
"test/benchmark/riot_vs_minitest.rb",
|
57
|
-
"test/benchmark/same_elements_vs_set.rb",
|
58
|
-
"test/benchmark/simple_context_and_assertions.rb",
|
59
|
-
"test/core/assertion_macros/any_test.rb",
|
60
|
-
"test/core/assertion_macros/assigns_test.rb",
|
61
|
-
"test/core/assertion_macros/empty_test.rb",
|
62
|
-
"test/core/assertion_macros/equals_test.rb",
|
63
|
-
"test/core/assertion_macros/equivalent_to_test.rb",
|
64
|
-
"test/core/assertion_macros/exists_test.rb",
|
65
|
-
"test/core/assertion_macros/includes_test.rb",
|
66
|
-
"test/core/assertion_macros/kind_of_test.rb",
|
67
|
-
"test/core/assertion_macros/matches_test.rb",
|
68
|
-
"test/core/assertion_macros/nil_test.rb",
|
69
|
-
"test/core/assertion_macros/not_borat_test.rb",
|
70
|
-
"test/core/assertion_macros/raises_test.rb",
|
71
|
-
"test/core/assertion_macros/respond_to_test.rb",
|
72
|
-
"test/core/assertion_macros/same_elements_test.rb",
|
73
|
-
"test/core/assertion_macros/size_test.rb",
|
74
|
-
"test/core/context/asserts_topic_test.rb",
|
75
|
-
"test/core/context/context_test.rb",
|
76
|
-
"test/core/context/context_with_options_test.rb",
|
77
|
-
"test/core/context/deny_test.rb",
|
78
|
-
"test/core/context/helper_test.rb",
|
79
|
-
"test/core/context/hookup_test.rb",
|
80
|
-
"test/core/context/nested_contexts_test.rb",
|
81
|
-
"test/core/context/premium_setup_test.rb",
|
82
|
-
"test/core/context/should_test.rb",
|
83
|
-
"test/core/context/using_describe_in_a_test.rb",
|
84
|
-
"test/core/middleware/chained_context_middleware_test.rb",
|
85
|
-
"test/core/middleware/context_middleware_test.rb",
|
86
|
-
"test/core/report_test.rb",
|
87
|
-
"test/core/runnable/assertion_macro_test.rb",
|
88
|
-
"test/core/runnable/assertion_test.rb",
|
89
|
-
"test/core/runnable/message_test.rb",
|
90
|
-
"test/core/runnable/negative_assertion_test.rb",
|
91
|
-
"test/core/runnable/setup_test.rb",
|
92
|
-
"test/core/runnable/situation_test.rb",
|
93
|
-
"test/core/runnable/teardown_test.rb",
|
94
|
-
"test/extensions/rrriot_test.rb",
|
95
|
-
"test/teststrap.rb"
|
96
|
-
]
|
97
|
-
s.homepage = %q{http://github.com/thumblemonks/riot}
|
6
|
+
s.name = %q{riot}
|
7
|
+
s.version = Riot::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Justin 'Gus' Knowlden"]
|
10
|
+
s.summary = %q{An extremely fast, expressive, and context-driven unit-testing framework. Protest the slow test.}
|
11
|
+
s.description = %q{An extremely fast, expressive, and context-driven unit-testing framework. A replacement for all other testing frameworks. Protest the slow test.}
|
12
|
+
s.email = %q{gus@gusg.us}
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.homepage = %q{http://github.com/thumblemonks/riot}
|
98
15
|
s.require_paths = ["lib"]
|
99
|
-
s.
|
100
|
-
s.summary = %q{An extremely fast, expressive, and context-driven unit-testing framework. Protest the slow test.}
|
101
|
-
s.test_files = [
|
102
|
-
"test/benchmark/colorize.rb",
|
103
|
-
"test/benchmark/message_concatenation.rb",
|
104
|
-
"test/benchmark/riot_vs_minitest.rb",
|
105
|
-
"test/benchmark/same_elements_vs_set.rb",
|
106
|
-
"test/benchmark/simple_context_and_assertions.rb",
|
107
|
-
"test/core/assertion_macros/any_test.rb",
|
108
|
-
"test/core/assertion_macros/assigns_test.rb",
|
109
|
-
"test/core/assertion_macros/empty_test.rb",
|
110
|
-
"test/core/assertion_macros/equals_test.rb",
|
111
|
-
"test/core/assertion_macros/equivalent_to_test.rb",
|
112
|
-
"test/core/assertion_macros/exists_test.rb",
|
113
|
-
"test/core/assertion_macros/includes_test.rb",
|
114
|
-
"test/core/assertion_macros/kind_of_test.rb",
|
115
|
-
"test/core/assertion_macros/matches_test.rb",
|
116
|
-
"test/core/assertion_macros/nil_test.rb",
|
117
|
-
"test/core/assertion_macros/not_borat_test.rb",
|
118
|
-
"test/core/assertion_macros/raises_test.rb",
|
119
|
-
"test/core/assertion_macros/respond_to_test.rb",
|
120
|
-
"test/core/assertion_macros/same_elements_test.rb",
|
121
|
-
"test/core/assertion_macros/size_test.rb",
|
122
|
-
"test/core/context/asserts_topic_test.rb",
|
123
|
-
"test/core/context/context_test.rb",
|
124
|
-
"test/core/context/context_with_options_test.rb",
|
125
|
-
"test/core/context/deny_test.rb",
|
126
|
-
"test/core/context/helper_test.rb",
|
127
|
-
"test/core/context/hookup_test.rb",
|
128
|
-
"test/core/context/nested_contexts_test.rb",
|
129
|
-
"test/core/context/premium_setup_test.rb",
|
130
|
-
"test/core/context/should_test.rb",
|
131
|
-
"test/core/context/using_describe_in_a_test.rb",
|
132
|
-
"test/core/middleware/chained_context_middleware_test.rb",
|
133
|
-
"test/core/middleware/context_middleware_test.rb",
|
134
|
-
"test/core/report_test.rb",
|
135
|
-
"test/core/runnable/assertion_macro_test.rb",
|
136
|
-
"test/core/runnable/assertion_test.rb",
|
137
|
-
"test/core/runnable/message_test.rb",
|
138
|
-
"test/core/runnable/negative_assertion_test.rb",
|
139
|
-
"test/core/runnable/setup_test.rb",
|
140
|
-
"test/core/runnable/situation_test.rb",
|
141
|
-
"test/core/runnable/teardown_test.rb",
|
142
|
-
"test/extensions/rrriot_test.rb",
|
143
|
-
"test/teststrap.rb"
|
144
|
-
]
|
145
|
-
|
146
|
-
if s.respond_to? :specification_version then
|
147
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
148
|
-
s.specification_version = 3
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
149
17
|
|
150
|
-
|
151
|
-
s.add_runtime_dependency(%q<rr>, [">= 0"])
|
152
|
-
s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
|
153
|
-
else
|
154
|
-
s.add_dependency(%q<rr>, [">= 0"])
|
155
|
-
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
156
|
-
end
|
157
|
-
else
|
158
|
-
s.add_dependency(%q<rr>, [">= 0"])
|
159
|
-
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
160
|
-
end
|
18
|
+
s.add_dependency 'rr', '>=0'
|
161
19
|
end
|
162
20
|
|
21
|
+
|
@@ -5,12 +5,12 @@ context "An any assertion macro" do
|
|
5
5
|
Riot::Assertion.new("test") { o }.any
|
6
6
|
end
|
7
7
|
|
8
|
-
assertion_test_passes("when an array has items", "
|
8
|
+
assertion_test_passes("when an array has items", "has items") { assert_any([1]) }
|
9
9
|
assertion_test_fails("when an array is empty", "expected [] to have items") do
|
10
10
|
assert_any([])
|
11
11
|
end
|
12
12
|
|
13
|
-
assertion_test_passes("when a hash has items", "
|
13
|
+
assertion_test_passes("when a hash has items", "has items") { assert_any({:name => 'washington'}) }
|
14
14
|
assertion_test_fails("when a hash is empty", "expected {} to have items") do
|
15
15
|
assert_any({})
|
16
16
|
end
|
@@ -27,25 +27,25 @@ context "A negative, any assertion macro" do
|
|
27
27
|
|
28
28
|
asserts(":pass when string is empty") do
|
29
29
|
any("").run(Riot::Situation.new)
|
30
|
-
end.equals([:pass, "has
|
30
|
+
end.equals([:pass, "has items"])
|
31
31
|
|
32
32
|
asserts(":pass when array is empty") do
|
33
33
|
any([]).run(Riot::Situation.new)
|
34
|
-
end.equals([:pass, "has
|
34
|
+
end.equals([:pass, "has items"])
|
35
35
|
|
36
36
|
asserts(":pass when hash is empty") do
|
37
37
|
any({}).run(Riot::Situation.new)
|
38
|
-
end.equals([:pass, "has
|
38
|
+
end.equals([:pass, "has items"])
|
39
39
|
|
40
40
|
asserts(":fail when string is empty") do
|
41
41
|
any("foo").run(Riot::Situation.new)[0..1]
|
42
|
-
end.equals([:fail, %Q{expected "foo" not to have
|
42
|
+
end.equals([:fail, %Q{expected "foo" not to have items}])
|
43
43
|
|
44
|
-
asserts(":fail when array has
|
44
|
+
asserts(":fail when array has items") do
|
45
45
|
any([1,2]).run(Riot::Situation.new)[0..1]
|
46
|
-
end.equals([:fail, %Q{expected [1, 2] not to have
|
46
|
+
end.equals([:fail, %Q{expected [1, 2] not to have items}])
|
47
47
|
|
48
|
-
asserts(":fail when hash has
|
48
|
+
asserts(":fail when hash has items") do
|
49
49
|
any({"bar" => "baz"}).run(Riot::Situation.new)[0..1]
|
50
|
-
end.equals([:fail, %Q{expected {"bar"=>"baz"} not to have
|
50
|
+
end.equals([:fail, %Q{expected {"bar"=>"baz"} not to have items}])
|
51
51
|
end
|
@@ -7,10 +7,10 @@ context "An assigns assertion macro" do
|
|
7
7
|
Riot::Assertion.new("test") { item }
|
8
8
|
end
|
9
9
|
|
10
|
-
assertion_test_passes("when foo is defined") { topic.assigns(:foo) }
|
11
|
-
assertion_test_passes("when foo is defined with expected value") { topic.assigns(:foo, 1) }
|
10
|
+
assertion_test_passes("when foo is defined","assigns :foo") { topic.assigns(:foo) }
|
11
|
+
assertion_test_passes("when foo is defined with expected value","assigns :foo with 1") { topic.assigns(:foo, 1) }
|
12
12
|
|
13
|
-
assertion_test_fails("when foo does not match expectation", "expected :foo to be
|
13
|
+
assertion_test_fails("when foo does not match expectation", "expected :foo to be assigned with 2, not 1") do
|
14
14
|
topic.assigns(:foo, 2)
|
15
15
|
end
|
16
16
|
|
@@ -32,15 +32,15 @@ context "A negative assigns assertion macro" do
|
|
32
32
|
|
33
33
|
asserts(":pass when @bar is not defined") do
|
34
34
|
topic.assigns(:bar).run(Riot::Situation.new)
|
35
|
-
end.equals([:pass, ""])
|
35
|
+
end.equals([:pass, "assigns :bar"])
|
36
36
|
|
37
37
|
asserts(":pass when @nil_val is actually nil") do
|
38
38
|
topic.assigns(:nil_val).run(Riot::Situation.new)
|
39
|
-
end.equals([:pass, ""])
|
39
|
+
end.equals([:pass, "assigns :nil_val"])
|
40
40
|
|
41
41
|
asserts(":pass when @foo does not equal 2") do
|
42
42
|
topic.assigns(:foo, 2).run(Riot::Situation.new)
|
43
|
-
end.equals([:pass, ""])
|
43
|
+
end.equals([:pass, "assigns :foo with 2"])
|
44
44
|
|
45
45
|
asserts(":fail when @foo is defined") do
|
46
46
|
topic.assigns(:foo).run(Riot::Situation.new)[0..1]
|
@@ -48,5 +48,5 @@ context "A negative assigns assertion macro" do
|
|
48
48
|
|
49
49
|
asserts(":fail when @foo does equal 1") do
|
50
50
|
topic.assigns(:foo, 1).run(Riot::Situation.new)[0..1]
|
51
|
-
end.equals([:fail, "expected :foo to not be
|
51
|
+
end.equals([:fail, "expected :foo to not be assigned with 1"])
|
52
52
|
end # A negative assigns assertion macro
|
@@ -38,7 +38,7 @@ context "A negative equivalent_to assertion macro" do
|
|
38
38
|
|
39
39
|
asserts("an array is not equivalent to 'what'") do
|
40
40
|
topic.equivalent_to([]).run(Riot::Situation.new)
|
41
|
-
end.equals([:pass, "is
|
41
|
+
end.equals([:pass, "is equivalent to []"])
|
42
42
|
|
43
43
|
context "with numeric topic" do
|
44
44
|
setup { Riot::Assertion.new("blue", true) { 31413 } }
|
@@ -49,7 +49,7 @@ context "A negative equivalent_to assertion macro" do
|
|
49
49
|
|
50
50
|
asserts ":pass when in expected range" do
|
51
51
|
topic.equivalent_to(32000..33000).run(Riot::Situation.new)
|
52
|
-
end.equals([:pass, "is
|
52
|
+
end.equals([:pass, "is equivalent to 32000..33000"])
|
53
53
|
|
54
54
|
end # with numeric topic
|
55
|
-
end # A negative equivalent_to assertion macro
|
55
|
+
end # A negative equivalent_to assertion macro
|
@@ -7,11 +7,11 @@ context "An exists assertion macro" do
|
|
7
7
|
|
8
8
|
asserts(":pass when result has a value") do
|
9
9
|
assert_exists("foo")
|
10
|
-
end.equals([:pass, "
|
10
|
+
end.equals([:pass, "does exist"])
|
11
11
|
|
12
12
|
asserts(":pass because empty string is considered a value") do
|
13
13
|
assert_exists("")
|
14
|
-
end.equals([:pass, "
|
14
|
+
end.equals([:pass, "does exist"])
|
15
15
|
|
16
16
|
asserts(":fail with message when value is nil") do
|
17
17
|
assert_exists(nil)[0..1]
|
@@ -33,6 +33,6 @@ context "A negative exists assertion macro" do
|
|
33
33
|
|
34
34
|
asserts(":pass when nil") do
|
35
35
|
assert_exists(nil)
|
36
|
-
end.equals([:pass, "
|
36
|
+
end.equals([:pass, "does exist"])
|
37
37
|
|
38
|
-
end # A negative exists assertion macro
|
38
|
+
end # A negative exists assertion macro
|
@@ -17,9 +17,9 @@ context "A negative includes assertion macro" do
|
|
17
17
|
Riot::Assertion.new("an array", true) { [1, 6, 42, 7] }
|
18
18
|
end
|
19
19
|
|
20
|
-
assertion_test_passes("when array doesn't include 69", "
|
20
|
+
assertion_test_passes("when array doesn't include 69", "includes 69") { topic.includes(69) }
|
21
21
|
|
22
22
|
assertion_test_fails("when 42 is included in array", "expected [1, 6, 42, 7] to not include 42") do
|
23
23
|
topic.includes(42)
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -15,7 +15,7 @@ context "A kind_of assertion macro" do
|
|
15
15
|
end # A kind_of assertion macro
|
16
16
|
|
17
17
|
context "A negative kind_of assertion macro" do
|
18
|
-
assertion_test_passes(":pass when specific result is not a kind of String", "is
|
18
|
+
assertion_test_passes(":pass when specific result is not a kind of String", "is a kind of String") do
|
19
19
|
Riot::Assertion.new("foo", true) { 1 }.kind_of(String)
|
20
20
|
end
|
21
21
|
|
@@ -23,8 +23,8 @@ context "A negative kind_of assertion macro" do
|
|
23
23
|
Riot::Assertion.new("foo", true) { "a" }.kind_of(String)
|
24
24
|
end
|
25
25
|
|
26
|
-
assertion_test_passes(":pass when nil", "is
|
26
|
+
assertion_test_passes(":pass when nil", "is a kind of String") do
|
27
27
|
Riot::Assertion.new("foo", true) { }.kind_of(String)
|
28
28
|
end
|
29
29
|
|
30
|
-
end # A negative kind_of assert macro
|
30
|
+
end # A negative kind_of assert macro
|
@@ -30,7 +30,7 @@ context "A negative matching assertion macro" do
|
|
30
30
|
topic.matches(/abc/)
|
31
31
|
end
|
32
32
|
|
33
|
-
assertion_test_passes("when expression does not match", '
|
33
|
+
assertion_test_passes("when expression does not match", 'matches /abcd/') do
|
34
34
|
topic.matches(/abcd/)
|
35
35
|
end
|
36
36
|
|
@@ -41,7 +41,7 @@ context "A negative matching assertion macro" do
|
|
41
41
|
topic.matches(/^42$/)
|
42
42
|
end
|
43
43
|
|
44
|
-
assertion_test_passes("actual value converted to string", '
|
44
|
+
assertion_test_passes("actual value converted to string", 'matches /^52$/') do
|
45
45
|
topic.matches(/^52$/)
|
46
46
|
end
|
47
47
|
end
|
@@ -10,6 +10,6 @@ end # A nil assertion macro
|
|
10
10
|
context "A negative nil assertion macro" do
|
11
11
|
helper(:assert_not_nil) { |o| Riot::Assertion.new("foo", true) { o }.nil.run(Riot::Situation.new) }
|
12
12
|
|
13
|
-
asserts(":pass when result is not nil") { assert_not_nil(1) }.equals([:pass, "is
|
13
|
+
asserts(":pass when result is not nil") { assert_not_nil(1) }.equals([:pass, "is nil"])
|
14
14
|
asserts(":fail with message") { assert_not_nil(nil)[0..1] }.equals([:fail, %Q{expected is nil, not "non-nil"}])
|
15
|
-
end # A negative nil assertion macro
|
15
|
+
end # A negative nil assertion macro
|
@@ -8,11 +8,11 @@ context "A raises assertion macro" do
|
|
8
8
|
asserts_raises(nil).raises(Whoops)
|
9
9
|
end
|
10
10
|
|
11
|
-
assertion_test_fails("when unexpected exception is raised", "
|
11
|
+
assertion_test_fails("when unexpected exception is raised", "expected to raise Exception, not Whoops") do
|
12
12
|
asserts_raises(nil).raises(Exception)
|
13
13
|
end
|
14
14
|
|
15
|
-
assertion_test_fails("when nothing was raised", "
|
15
|
+
assertion_test_fails("when nothing was raised", "expected to raise Whoops, but raised nothing") do
|
16
16
|
assertion = Riot::Assertion.new("foo") { "barf" }.raises(Whoops)
|
17
17
|
end
|
18
18
|
|
@@ -36,31 +36,31 @@ end # A raises assertion macro
|
|
36
36
|
context "A negative raises assertion macro" do
|
37
37
|
helper(:deny_raises) { |o| Riot::Assertion.new("foo", true) { raise Whoops, o } }
|
38
38
|
|
39
|
-
assertion_test_fails("when expected exception is raised", "
|
39
|
+
assertion_test_fails("when expected exception is raised", "expected to not raise Whoops") do
|
40
40
|
deny_raises(nil).raises(Whoops)
|
41
41
|
end
|
42
42
|
|
43
|
-
assertion_test_passes("when unexpected exception is raised", "
|
43
|
+
assertion_test_passes("when unexpected exception is raised", "raises Exception") do
|
44
44
|
deny_raises(nil).raises(Exception)
|
45
45
|
end
|
46
46
|
|
47
|
-
assertion_test_passes("when nothing was raised", "
|
47
|
+
assertion_test_passes("when nothing was raised", "raises Whoops") do
|
48
48
|
Riot::Assertion.new("foo", true) { "barf" }.raises(Whoops)
|
49
49
|
end
|
50
50
|
|
51
|
-
assertion_test_fails("when provided message equals expected message", '
|
51
|
+
assertion_test_fails("when provided message equals expected message", 'expected to not raise Whoops with message "Mom", but raised Whoops with message "Mom"') do
|
52
52
|
deny_raises('Mom').raises(Whoops, 'Mom')
|
53
53
|
end
|
54
54
|
|
55
|
-
assertion_test_passes("when messages and exception aren't equal", '
|
55
|
+
assertion_test_passes("when messages and exception aren't equal", 'raises Exception with message "Dad"') do
|
56
56
|
deny_raises('Mom').raises(Exception, 'Dad')
|
57
57
|
end
|
58
58
|
|
59
|
-
assertion_test_fails("when provided message matches expected message", '
|
59
|
+
assertion_test_fails("when provided message matches expected message", 'expected to not raise Whoops with message /Mom/, but raised Whoops with message "Mom"') do
|
60
60
|
deny_raises('Mom').raises(Whoops, /Mom/)
|
61
61
|
end
|
62
62
|
|
63
|
-
assertion_test_fails("when messages don't match", "
|
63
|
+
assertion_test_fails("when messages don't match", "expected to not raise Whoops with message /Mom/, but raised Whoops with message \"Dad\"") do
|
64
64
|
deny_raises('Dad').raises(Whoops,/Mom/)
|
65
65
|
end
|
66
|
-
end # A raises assertion macro
|
66
|
+
end # A raises assertion macro
|
@@ -23,8 +23,8 @@ context "A negative respond_to assertion macro" do
|
|
23
23
|
topic.responds_to(:length)
|
24
24
|
end
|
25
25
|
|
26
|
-
assertion_test_passes("when method is not defined", "
|
26
|
+
assertion_test_passes("when method is not defined", "responds to :goofballs") do
|
27
27
|
topic.respond_to(:goofballs)
|
28
28
|
end
|
29
29
|
|
30
|
-
end
|
30
|
+
end
|
@@ -3,11 +3,11 @@ require 'teststrap'
|
|
3
3
|
context "A same_elements assertion macro" do
|
4
4
|
setup { Riot::Assertion.new("test") { ["foo", "bar", 69] } }
|
5
5
|
|
6
|
-
assertion_test_passes(%Q{when [69, "foo", "bar"] are returned}) do
|
6
|
+
assertion_test_passes(%Q{when [69, "foo", "bar"] are returned},%Q{has same elements as [69, "foo", "bar"]}) do
|
7
7
|
topic.same_elements([69, "foo", "bar"])
|
8
8
|
end
|
9
9
|
|
10
|
-
assertion_test_passes(%Q{when [69, "foo", "bar"] are returned in any order}) do
|
10
|
+
assertion_test_passes(%Q{when [69, "foo", "bar"] are returned in any order},%Q{has same elements as ["foo", "bar", 69]}) do
|
11
11
|
topic.same_elements(["foo", "bar", 69])
|
12
12
|
end
|
13
13
|
|
@@ -27,8 +27,8 @@ context "A negative same_elements assertion macro" do
|
|
27
27
|
topic.same_elements(["foo", "bar", 69])
|
28
28
|
end
|
29
29
|
|
30
|
-
assertion_test_passes("when elements do not match") do
|
30
|
+
assertion_test_passes("when elements do not match",%Q{has same elements as ["foo", "bar", 96]}) do
|
31
31
|
topic.same_elements(["foo", "bar", 96])
|
32
32
|
end
|
33
33
|
|
34
|
-
end # A negative same_elements macro
|
34
|
+
end # A negative same_elements macro
|