assert 2.15.2 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/lib/assert/assertions.rb +6 -0
  3. data/lib/assert/config_helpers.rb +35 -14
  4. data/lib/assert/context.rb +36 -43
  5. data/lib/assert/context/test_dsl.rb +4 -4
  6. data/lib/assert/default_suite.rb +35 -40
  7. data/lib/assert/default_view.rb +109 -37
  8. data/lib/assert/file_line.rb +1 -1
  9. data/lib/assert/result.rb +67 -27
  10. data/lib/assert/runner.rb +14 -10
  11. data/lib/assert/suite.rb +41 -50
  12. data/lib/assert/test.rb +39 -81
  13. data/lib/assert/version.rb +1 -1
  14. data/lib/assert/view_helpers.rb +11 -21
  15. data/test/helper.rb +40 -0
  16. data/test/system/test_tests.rb +90 -88
  17. data/test/unit/assertions/assert_block_tests.rb +14 -10
  18. data/test/unit/assertions/assert_empty_tests.rb +14 -10
  19. data/test/unit/assertions/assert_equal_tests.rb +22 -14
  20. data/test/unit/assertions/assert_file_exists_tests.rb +14 -10
  21. data/test/unit/assertions/assert_includes_tests.rb +14 -10
  22. data/test/unit/assertions/assert_instance_of_tests.rb +14 -10
  23. data/test/unit/assertions/assert_kind_of_tests.rb +14 -10
  24. data/test/unit/assertions/assert_match_tests.rb +14 -10
  25. data/test/unit/assertions/assert_nil_tests.rb +14 -10
  26. data/test/unit/assertions/assert_raises_tests.rb +14 -10
  27. data/test/unit/assertions/assert_respond_to_tests.rb +14 -10
  28. data/test/unit/assertions/assert_same_tests.rb +20 -14
  29. data/test/unit/assertions/assert_true_false_tests.rb +28 -20
  30. data/test/unit/assertions_tests.rb +12 -9
  31. data/test/unit/config_helpers_tests.rb +72 -13
  32. data/test/unit/context/test_dsl_tests.rb +38 -45
  33. data/test/unit/context_tests.rb +12 -8
  34. data/test/unit/default_suite_tests.rb +66 -43
  35. data/test/unit/file_line_tests.rb +4 -1
  36. data/test/unit/result_tests.rb +71 -47
  37. data/test/unit/runner_tests.rb +34 -16
  38. data/test/unit/suite_tests.rb +61 -29
  39. data/test/unit/test_tests.rb +97 -134
  40. data/test/unit/view_helpers_tests.rb +17 -31
  41. 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 :test_count_statement, :result_count_statement
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 test count and result count statements" do
93
- exp = "#{subject.count(:tests)} test#{'s' if subject.count(:tests) != 1}"
94
- assert_equal exp, subject.test_count_statement
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.count(:results)} result#{'s' if subject.count(:results) != 1}"
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, :count).with(:results){ 0 }
99
+ Assert.stub(subject, :result_count){ 0 }
114
100
  assert_equal "uhh...", subject.all_pass_result_summary_msg
115
101
 
116
- Assert.stub(subject, :count).with(:results){ 1 }
102
+ Assert.stub(subject, :result_count){ 1 }
117
103
  assert_equal "pass", subject.all_pass_result_summary_msg
118
104
 
119
- Assert.stub(subject, :count).with(:results){ Factory.integer(10)+1 }
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.count(res_type)} #{res_type.to_s}"
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
- result = [:pass, :fail, :error, :skip, :ignore].sample
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, result)
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, result)
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, result)
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, "#{result}_styles"){ [] }
205
- assert_equal msg, subject.ansi_styled_msg(msg, result)
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, "#{result}_styles"){ styles }
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, result)
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.15.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-04-13 00:00:00 Z
13
+ date: 2016-05-13 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Assertion style testing framework.