assert 2.15.2 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/assert/assertions.rb +6 -0
- data/lib/assert/config_helpers.rb +35 -14
- data/lib/assert/context.rb +36 -43
- data/lib/assert/context/test_dsl.rb +4 -4
- data/lib/assert/default_suite.rb +35 -40
- data/lib/assert/default_view.rb +109 -37
- data/lib/assert/file_line.rb +1 -1
- data/lib/assert/result.rb +67 -27
- data/lib/assert/runner.rb +14 -10
- data/lib/assert/suite.rb +41 -50
- data/lib/assert/test.rb +39 -81
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view_helpers.rb +11 -21
- data/test/helper.rb +40 -0
- data/test/system/test_tests.rb +90 -88
- data/test/unit/assertions/assert_block_tests.rb +14 -10
- data/test/unit/assertions/assert_empty_tests.rb +14 -10
- data/test/unit/assertions/assert_equal_tests.rb +22 -14
- data/test/unit/assertions/assert_file_exists_tests.rb +14 -10
- data/test/unit/assertions/assert_includes_tests.rb +14 -10
- data/test/unit/assertions/assert_instance_of_tests.rb +14 -10
- data/test/unit/assertions/assert_kind_of_tests.rb +14 -10
- data/test/unit/assertions/assert_match_tests.rb +14 -10
- data/test/unit/assertions/assert_nil_tests.rb +14 -10
- data/test/unit/assertions/assert_raises_tests.rb +14 -10
- data/test/unit/assertions/assert_respond_to_tests.rb +14 -10
- data/test/unit/assertions/assert_same_tests.rb +20 -14
- data/test/unit/assertions/assert_true_false_tests.rb +28 -20
- data/test/unit/assertions_tests.rb +12 -9
- data/test/unit/config_helpers_tests.rb +72 -13
- data/test/unit/context/test_dsl_tests.rb +38 -45
- data/test/unit/context_tests.rb +12 -8
- data/test/unit/default_suite_tests.rb +66 -43
- data/test/unit/file_line_tests.rb +4 -1
- data/test/unit/result_tests.rb +71 -47
- data/test/unit/runner_tests.rb +34 -16
- data/test/unit/suite_tests.rb +61 -29
- data/test/unit/test_tests.rb +97 -134
- data/test/unit/view_helpers_tests.rb +17 -31
- metadata +2 -2
@@ -55,26 +55,12 @@ module Assert::ViewHelpers
|
|
55
55
|
end
|
56
56
|
subject{ @helpers }
|
57
57
|
|
58
|
-
should have_imeths :test_run_time, :test_result_rate
|
59
58
|
should have_imeths :captured_output, :re_run_test_cmd
|
60
|
-
should have_imeths :
|
59
|
+
should have_imeths :tests_to_run_count_statement, :result_count_statement
|
61
60
|
should have_imeths :to_sentence
|
62
61
|
should have_imeths :all_pass_result_summary_msg, :result_summary_msg
|
63
62
|
should have_imeths :results_summary_sentence
|
64
63
|
|
65
|
-
should "know a test's formatted run time and result rate" do
|
66
|
-
test = Factory.test
|
67
|
-
format = '%.6f'
|
68
|
-
|
69
|
-
exp = format % test.run_time
|
70
|
-
assert_equal exp, subject.test_run_time(test, format)
|
71
|
-
assert_equal exp, subject.test_run_time(test)
|
72
|
-
|
73
|
-
exp = format % test.result_rate
|
74
|
-
assert_equal exp, subject.test_result_rate(test, format)
|
75
|
-
assert_equal exp, subject.test_result_rate(test)
|
76
|
-
end
|
77
|
-
|
78
64
|
should "know how to build captured output" do
|
79
65
|
output = Factory.string
|
80
66
|
exp = "--- stdout ---\n"\
|
@@ -89,11 +75,11 @@ module Assert::ViewHelpers
|
|
89
75
|
assert_equal exp, subject.re_run_test_cmd(test_id)
|
90
76
|
end
|
91
77
|
|
92
|
-
should "know its
|
93
|
-
exp = "#{subject.
|
94
|
-
assert_equal exp, subject.
|
78
|
+
should "know its tests-to-run count and result count statements" do
|
79
|
+
exp = "#{subject.tests_to_run_count} test#{'s' if subject.tests_to_run_count != 1}"
|
80
|
+
assert_equal exp, subject.tests_to_run_count_statement
|
95
81
|
|
96
|
-
exp = "#{subject.
|
82
|
+
exp = "#{subject.result_count} result#{'s' if subject.result_count != 1}"
|
97
83
|
assert_equal exp, subject.result_count_statement
|
98
84
|
end
|
99
85
|
|
@@ -110,13 +96,13 @@ module Assert::ViewHelpers
|
|
110
96
|
end
|
111
97
|
|
112
98
|
should "know its all pass result summary message" do
|
113
|
-
Assert.stub(subject, :
|
99
|
+
Assert.stub(subject, :result_count){ 0 }
|
114
100
|
assert_equal "uhh...", subject.all_pass_result_summary_msg
|
115
101
|
|
116
|
-
Assert.stub(subject, :
|
102
|
+
Assert.stub(subject, :result_count){ 1 }
|
117
103
|
assert_equal "pass", subject.all_pass_result_summary_msg
|
118
104
|
|
119
|
-
Assert.stub(subject, :
|
105
|
+
Assert.stub(subject, :result_count){ Factory.integer(10)+1 }
|
120
106
|
assert_equal "all pass", subject.all_pass_result_summary_msg
|
121
107
|
end
|
122
108
|
|
@@ -128,7 +114,7 @@ module Assert::ViewHelpers
|
|
128
114
|
|
129
115
|
Assert.stub(subject, :all_pass?){ false }
|
130
116
|
res_type = [:pass, :ignore, :fail, :skip, :error].sample
|
131
|
-
exp = "#{subject.
|
117
|
+
exp = "#{subject.send("#{res_type}_result_count")} #{res_type.to_s}"
|
132
118
|
assert_equal exp, subject.result_summary_msg(res_type)
|
133
119
|
end
|
134
120
|
|
@@ -185,30 +171,30 @@ module Assert::ViewHelpers
|
|
185
171
|
|
186
172
|
should "know how to build ansi styled messages" do
|
187
173
|
msg = Factory.string
|
188
|
-
|
174
|
+
result_type = [:pass, :fail, :error, :skip, :ignore].sample
|
189
175
|
|
190
176
|
Assert.stub(subject, :is_tty?){ false }
|
191
177
|
Assert.stub(subject, :styled){ false }
|
192
|
-
assert_equal msg, subject.ansi_styled_msg(msg,
|
178
|
+
assert_equal msg, subject.ansi_styled_msg(msg, result_type)
|
193
179
|
|
194
180
|
Assert.stub(subject, :is_tty?){ false }
|
195
181
|
Assert.stub(subject, :styled){ true }
|
196
|
-
assert_equal msg, subject.ansi_styled_msg(msg,
|
182
|
+
assert_equal msg, subject.ansi_styled_msg(msg, result_type)
|
197
183
|
|
198
184
|
Assert.stub(subject, :is_tty?){ true }
|
199
185
|
Assert.stub(subject, :styled){ false }
|
200
|
-
assert_equal msg, subject.ansi_styled_msg(msg,
|
186
|
+
assert_equal msg, subject.ansi_styled_msg(msg, result_type)
|
201
187
|
|
202
188
|
Assert.stub(subject, :is_tty?){ true }
|
203
189
|
Assert.stub(subject, :styled){ true }
|
204
|
-
Assert.stub(subject, "#{
|
205
|
-
assert_equal msg, subject.ansi_styled_msg(msg,
|
190
|
+
Assert.stub(subject, "#{result_type}_styles"){ [] }
|
191
|
+
assert_equal msg, subject.ansi_styled_msg(msg, result_type)
|
206
192
|
|
207
193
|
styles = Factory.integer(3).times.map{ Assert::ViewHelpers::Ansi::CODES.keys.sample }
|
208
|
-
Assert.stub(subject, "#{
|
194
|
+
Assert.stub(subject, "#{result_type}_styles"){ styles }
|
209
195
|
exp_code = Assert::ViewHelpers::Ansi.code_for(*styles)
|
210
196
|
exp = exp_code + msg + Assert::ViewHelpers::Ansi.code_for(:reset)
|
211
|
-
assert_equal exp, subject.ansi_styled_msg(msg,
|
197
|
+
assert_equal exp, subject.ansi_styled_msg(msg, result_type)
|
212
198
|
end
|
213
199
|
|
214
200
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-05-13 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Assertion style testing framework.
|