assert 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +0 -4
  4. data/assert.gemspec +2 -3
  5. data/lib/assert.rb +0 -10
  6. data/lib/assert/assert_runner.rb +0 -3
  7. data/lib/assert/assertions.rb +0 -4
  8. data/lib/assert/cli.rb +30 -46
  9. data/lib/assert/config.rb +0 -4
  10. data/lib/assert/config_helpers.rb +0 -4
  11. data/lib/assert/context.rb +0 -2
  12. data/lib/assert/context/setup_dsl.rb +0 -4
  13. data/lib/assert/context/subject_dsl.rb +0 -4
  14. data/lib/assert/context/suite_dsl.rb +0 -4
  15. data/lib/assert/context/test_dsl.rb +0 -4
  16. data/lib/assert/context_info.rb +0 -4
  17. data/lib/assert/default_runner.rb +0 -4
  18. data/lib/assert/default_suite.rb +0 -5
  19. data/lib/assert/default_view.rb +0 -4
  20. data/lib/assert/factory.rb +0 -3
  21. data/lib/assert/file_line.rb +0 -4
  22. data/lib/assert/macro.rb +0 -3
  23. data/lib/assert/macros/methods.rb +0 -6
  24. data/lib/assert/result.rb +2 -17
  25. data/lib/assert/runner.rb +0 -3
  26. data/lib/assert/stub.rb +0 -2
  27. data/lib/assert/suite.rb +0 -4
  28. data/lib/assert/test.rb +2 -7
  29. data/lib/assert/utils.rb +0 -4
  30. data/lib/assert/version.rb +1 -1
  31. data/lib/assert/view.rb +0 -3
  32. data/lib/assert/view_helpers.rb +0 -11
  33. data/log/{.gitkeep → .keep} +0 -0
  34. data/test/helper.rb +0 -4
  35. data/test/support/factory.rb +0 -1
  36. data/test/support/inherited_stuff.rb +0 -2
  37. data/test/system/stub_tests.rb +0 -19
  38. data/test/system/test_tests.rb +0 -16
  39. data/test/unit/assert_tests.rb +0 -4
  40. data/test/unit/assertions/assert_block_tests.rb +0 -4
  41. data/test/unit/assertions/assert_empty_tests.rb +0 -3
  42. data/test/unit/assertions/assert_equal_tests.rb +0 -8
  43. data/test/unit/assertions/assert_file_exists_tests.rb +0 -3
  44. data/test/unit/assertions/assert_includes_tests.rb +0 -4
  45. data/test/unit/assertions/assert_instance_of_tests.rb +0 -4
  46. data/test/unit/assertions/assert_kind_of_tests.rb +0 -4
  47. data/test/unit/assertions/assert_match_tests.rb +0 -4
  48. data/test/unit/assertions/assert_nil_tests.rb +0 -4
  49. data/test/unit/assertions/assert_raises_tests.rb +2 -6
  50. data/test/unit/assertions/assert_respond_to_tests.rb +0 -4
  51. data/test/unit/assertions/assert_same_tests.rb +0 -7
  52. data/test/unit/assertions/assert_true_false_tests.rb +0 -6
  53. data/test/unit/assertions_tests.rb +0 -4
  54. data/test/unit/config_helpers_tests.rb +0 -3
  55. data/test/unit/config_tests.rb +0 -3
  56. data/test/unit/context/setup_dsl_tests.rb +0 -8
  57. data/test/unit/context/subject_dsl_tests.rb +0 -6
  58. data/test/unit/context/suite_dsl_tests.rb +0 -4
  59. data/test/unit/context/test_dsl_tests.rb +0 -3
  60. data/test/unit/context_info_tests.rb +0 -3
  61. data/test/unit/context_tests.rb +2 -18
  62. data/test/unit/default_runner_tests.rb +0 -3
  63. data/test/unit/default_suite_tests.rb +0 -3
  64. data/test/unit/factory_tests.rb +0 -3
  65. data/test/unit/file_line_tests.rb +0 -4
  66. data/test/unit/macro_tests.rb +0 -8
  67. data/test/unit/result_tests.rb +0 -13
  68. data/test/unit/runner_tests.rb +0 -7
  69. data/test/unit/suite_tests.rb +0 -4
  70. data/test/unit/test_tests.rb +0 -12
  71. data/test/unit/utils_tests.rb +0 -9
  72. data/test/unit/view_helpers_tests.rb +0 -6
  73. data/test/unit/view_tests.rb +0 -4
  74. metadata +8 -9
  75. data/tmp/.gitkeep +0 -0
@@ -1,7 +1,5 @@
1
1
  module Assert
2
-
3
2
  class FileLine
4
-
5
3
  def self.parse(file_line_path)
6
4
  self.new(*(file_line_path.to_s.match(/(^[^\:]*)\:*(\d*).*$/) || [])[1..2])
7
5
  end
@@ -24,7 +22,5 @@ module Assert
24
22
  super
25
23
  end
26
24
  end
27
-
28
25
  end
29
-
30
26
  end
@@ -1,10 +1,8 @@
1
1
  module Assert
2
2
  class Macro < ::Proc
3
-
4
3
  # this class is essentially a way to define a custom set of tests using
5
4
  # arguments. When passed as an argument to the "should" method, a macro
6
5
  # will be instance_eval'd in that Assert::Context.
7
-
8
6
  attr_accessor :name
9
7
 
10
8
  def initialize(name = nil, *args, &block)
@@ -12,6 +10,5 @@ module Assert
12
10
  @name = name || "run this macro"
13
11
  super()
14
12
  end
15
-
16
13
  end
17
14
  end
@@ -2,13 +2,11 @@ require "assert/macro"
2
2
 
3
3
  module Assert::Macros
4
4
  module Methods
5
-
6
5
  def self.included(receiver)
7
6
  receiver.send(:extend, ClassMethods)
8
7
  end
9
8
 
10
9
  module ClassMethods
11
-
12
10
  def have_instance_method(*methods)
13
11
  called_from = (methods.last.kind_of?(Array) ? methods.pop : caller_locations).first
14
12
  Assert::Macro.new do
@@ -101,7 +99,6 @@ module Assert::Macros
101
99
 
102
100
  def _methods_macro_test(called_from)
103
101
  @_methods_macro_test ||= test "should respond to methods", called_from do
104
-
105
102
  self.class._methods_macro_instance_methods.each do |(method, called_from)|
106
103
  msg = "#{subject.class.name} does not have instance method ##{method}"
107
104
  with_backtrace([called_from]) do
@@ -129,7 +126,6 @@ module Assert::Macros
129
126
  assert_not_respond_to method, subject.class, msg
130
127
  end
131
128
  end
132
-
133
129
  end
134
130
  end
135
131
 
@@ -148,8 +144,6 @@ module Assert::Macros
148
144
  def _methods_macro_not_class_methods
149
145
  @_methods_macro_not_class_methods ||= []
150
146
  end
151
-
152
147
  end
153
-
154
148
  end
155
149
  end
@@ -2,7 +2,6 @@ require "assert/file_line"
2
2
 
3
3
  module Assert; end
4
4
  module Assert::Result
5
-
6
5
  class Base ; end
7
6
  class Pass < Base ; end
8
7
  class Ignore < Base ; end
@@ -26,7 +25,6 @@ module Assert::Result
26
25
  end
27
26
 
28
27
  class Base
29
-
30
28
  def self.type; :unknown; end
31
29
  def self.name; ""; end
32
30
 
@@ -156,7 +154,7 @@ module Assert::Result
156
154
  end
157
155
 
158
156
  # if the filtered backtrace is empty, just use the backtrace itself (this
159
- # should only occur if the result is an error from a line in assert's
157
+ # should only occur if the result is an error from a line in Assert's
160
158
  # non-test code).
161
159
  def first_filtered_bt_line(backtrace)
162
160
  ((fbt = backtrace.filtered).empty? ? backtrace : fbt).first.to_s
@@ -164,17 +162,13 @@ module Assert::Result
164
162
  end
165
163
 
166
164
  class Pass < Base
167
-
168
165
  def self.type; :pass; end
169
166
  def self.name; "Pass"; end
170
-
171
167
  end
172
168
 
173
169
  class Ignore < Base
174
-
175
170
  def self.type; :ignore; end
176
171
  def self.name; "Ignore"; end
177
-
178
172
  end
179
173
 
180
174
  class HaltingTestResultError < RuntimeError
@@ -185,7 +179,6 @@ module Assert::Result
185
179
  TestFailure = Class.new(HaltingTestResultError)
186
180
 
187
181
  class Fail < Base
188
-
189
182
  def self.type; :fail; end
190
183
  def self.name; "Fail"; end
191
184
 
@@ -201,14 +194,12 @@ module Assert::Result
201
194
  super(test, msg_or_err, bt)
202
195
  end
203
196
  end
204
-
205
197
  end
206
198
 
207
199
  # raised by the "skip" context helper to break test execution
208
200
  TestSkipped = Class.new(HaltingTestResultError)
209
201
 
210
202
  class Skip < Base
211
-
212
203
  def self.type; :skip; end
213
204
  def self.name; "Skip"; end
214
205
 
@@ -224,11 +215,9 @@ module Assert::Result
224
215
  super(test, msg_or_err, bt)
225
216
  end
226
217
  end
227
-
228
218
  end
229
219
 
230
220
  class Error < Base
231
-
232
221
  def self.type; :error; end
233
222
  def self.name; "Error"; end
234
223
 
@@ -247,11 +236,9 @@ module Assert::Result
247
236
  def build_trace
248
237
  Backtrace.to_s(backtrace)
249
238
  end
250
-
251
239
  end
252
240
 
253
241
  class Backtrace < ::Array
254
-
255
242
  DELIM = "\n".freeze
256
243
 
257
244
  def self.parse(bt)
@@ -272,7 +259,7 @@ module Assert::Result
272
259
 
273
260
  protected
274
261
 
275
- # filter a line out if it's an assert lib/bin line
262
+ # filter a line out if it's an Assert lib/bin line
276
263
  def filter_out?(line)
277
264
  # "./lib" in project dir, or "/usr/local/blahblah" if installed
278
265
  assert_lib_path = File.expand_path("../..", __FILE__)
@@ -283,7 +270,5 @@ module Assert::Result
283
270
  ) ||
284
271
  line =~ assert_bin_regex
285
272
  end
286
-
287
273
  end
288
-
289
274
  end
@@ -3,7 +3,6 @@ require "assert/suite"
3
3
  require "assert/view"
4
4
 
5
5
  module Assert
6
-
7
6
  class Runner
8
7
  include Assert::ConfigHelpers
9
8
 
@@ -103,7 +102,5 @@ module Assert
103
102
  self.suite.sorted_tests_to_run{ rand self.tests_to_run_count }
104
103
  end
105
104
  end
106
-
107
105
  end
108
-
109
106
  end
@@ -1,7 +1,6 @@
1
1
  require "much-stub"
2
2
 
3
3
  module Assert
4
-
5
4
  def self.stubs
6
5
  MuchStub.stubs
7
6
  end
@@ -27,5 +26,4 @@ module Assert
27
26
  raise err
28
27
  end
29
28
  end
30
-
31
29
  end
@@ -2,13 +2,11 @@ require "assert/config_helpers"
2
2
  require "assert/test"
3
3
 
4
4
  module Assert
5
-
6
5
  # This is the base suite. It loads the tests to run in memory and provides
7
6
  # methods for these tests that the runner/view uses for handling and
8
7
  # presentation purposes. It also stores suite-level setups and teardowns.
9
8
  # Override the test/result count methods and the callbacks as needed. See
10
9
  # the default suite for example usage.
11
-
12
10
  class Suite
13
11
  include Assert::ConfigHelpers
14
12
 
@@ -101,7 +99,5 @@ module Assert
101
99
  " test_count=#{self.test_count.inspect}"\
102
100
  " result_count=#{self.result_count.inspect}>"
103
101
  end
104
-
105
102
  end
106
-
107
103
  end
@@ -3,12 +3,9 @@ require "assert/file_line"
3
3
  require "assert/result"
4
4
 
5
5
  module Assert
6
-
7
6
  class Test
8
-
9
- # a Test is some code/method to run in the scope of a Context that may
10
- # produce results
11
-
7
+ # Test is some code/method to run in the scope of a Context that may
8
+ # produce results.
12
9
  def self.name_file_line_context_data(ci, name)
13
10
  { :name => ci.test_name(name),
14
11
  :file_line => ci.called_from
@@ -147,7 +144,5 @@ module Assert
147
144
  def capture_io
148
145
  StringIO.new(self.output, "a+")
149
146
  end
150
-
151
147
  end
152
-
153
148
  end
@@ -1,9 +1,7 @@
1
1
  require "assert"
2
2
 
3
3
  module Assert
4
-
5
4
  module Utils
6
-
7
5
  # show objects in a human-readable manner. Either inspects or pretty-prints
8
6
  # them depending on settings.
9
7
  def self.show(obj, config)
@@ -73,10 +71,8 @@ module Assert
73
71
  files
74
72
  end
75
73
  end
76
-
77
74
  end
78
75
 
79
76
  # alias for brevity
80
77
  U = Utils
81
-
82
78
  end
@@ -1,3 +1,3 @@
1
1
  module Assert
2
- VERSION = "2.17.0"
2
+ VERSION = "2.18.0"
3
3
  end
@@ -4,7 +4,6 @@ require "assert/suite"
4
4
  require "assert/view_helpers"
5
5
 
6
6
  module Assert
7
-
8
7
  class View
9
8
  include Assert::ConfigHelpers
10
9
  include Assert::ViewHelpers
@@ -92,7 +91,5 @@ module Assert
92
91
 
93
92
  def puts(*args); @output_io.puts(*args); end
94
93
  def print(*args); @output_io.print(*args); end
95
-
96
94
  end
97
-
98
95
  end
@@ -1,9 +1,7 @@
1
1
  require "assert/config_helpers"
2
2
 
3
3
  module Assert
4
-
5
4
  module ViewHelpers
6
-
7
5
  def self.included(receiver)
8
6
  receiver.class_eval do
9
7
  include Assert::ConfigHelpers
@@ -13,7 +11,6 @@ module Assert
13
11
  end
14
12
 
15
13
  module ClassMethods
16
-
17
14
  def option(name, *default_vals)
18
15
  default = default_vals.size > 1 ? default_vals : default_vals.first
19
16
  define_method(name) do |*args|
@@ -23,11 +20,9 @@ module Assert
23
20
  (val = instance_variable_get("@#{name}")).nil? ? default : val
24
21
  end
25
22
  end
26
-
27
23
  end
28
24
 
29
25
  module InstanceMethods
30
-
31
26
  # show any captured output
32
27
  def captured_output(output)
33
28
  "--- stdout ---\n"\
@@ -86,13 +81,10 @@ module Assert
86
81
  end
87
82
  self.to_sentence(summaries)
88
83
  end
89
-
90
84
  end
91
85
 
92
86
  module Ansi
93
-
94
87
  # Table of supported styles/codes (http://en.wikipedia.org/wiki/ANSI_escape_code)
95
-
96
88
  CODES = {
97
89
  :clear => 0,
98
90
  :reset => 0,
@@ -182,9 +174,6 @@ module Assert
182
174
  return msg if code.empty?
183
175
  code + msg + Assert::ViewHelpers::Ansi.code_for(:reset)
184
176
  end
185
-
186
177
  end
187
-
188
178
  end
189
-
190
179
  end
File without changes
@@ -10,9 +10,7 @@ require "pry"
10
10
  require "test/support/factory"
11
11
 
12
12
  class Assert::Test
13
-
14
13
  module TestHelpers
15
-
16
14
  def self.included(receiver)
17
15
  receiver.class_eval do
18
16
  setup do
@@ -44,7 +42,5 @@ class Assert::Test
44
42
  @test_run_results.last
45
43
  end
46
44
  end
47
-
48
45
  end
49
-
50
46
  end
@@ -85,5 +85,4 @@ module Factory
85
85
  instance_eval(&block) if !block.nil?
86
86
  end
87
87
  end
88
-
89
88
  end
@@ -24,7 +24,6 @@ class SuperStuff
24
24
  def test_repeated
25
25
  "repeated test from super"
26
26
  end
27
-
28
27
  end
29
28
 
30
29
  class SubStuff < SuperStuff
@@ -45,5 +44,4 @@ class SubStuff < SuperStuff
45
44
  def test_repeated
46
45
  "repeated test from sub"
47
46
  end
48
-
49
47
  end
@@ -2,10 +2,8 @@ require "assert"
2
2
  require "assert/stub"
3
3
 
4
4
  class Assert::Stub
5
-
6
5
  class SystemTests < Assert::Context
7
6
  desc "Assert::Stub"
8
-
9
7
  end
10
8
 
11
9
  class InstanceTests < SystemTests
@@ -79,7 +77,6 @@ class Assert::Stub
79
77
 
80
78
  assert_raises{ subject.withblock(1) }
81
79
  end
82
-
83
80
  end
84
81
 
85
82
  class ClassTests < SystemTests
@@ -153,7 +150,6 @@ class Assert::Stub
153
150
 
154
151
  assert_raises{ subject.withblock(1) }
155
152
  end
156
-
157
153
  end
158
154
 
159
155
  class ModuleTests < SystemTests
@@ -227,7 +223,6 @@ class Assert::Stub
227
223
 
228
224
  assert_raises{ subject.withblock(1) }
229
225
  end
230
-
231
226
  end
232
227
 
233
228
  class ExtendedTests < SystemTests
@@ -301,7 +296,6 @@ class Assert::Stub
301
296
 
302
297
  assert_raises{ subject.withblock(1) }
303
298
  end
304
-
305
299
  end
306
300
 
307
301
  class IncludedTests < SystemTests
@@ -376,7 +370,6 @@ class Assert::Stub
376
370
 
377
371
  assert_raises{ subject.withblock(1) }
378
372
  end
379
-
380
373
  end
381
374
 
382
375
  class InheritedClassTests < SystemTests
@@ -450,7 +443,6 @@ class Assert::Stub
450
443
 
451
444
  assert_raises{ subject.withblock(1) }
452
445
  end
453
-
454
446
  end
455
447
 
456
448
  class InheritedInstanceTests < SystemTests
@@ -525,7 +517,6 @@ class Assert::Stub
525
517
 
526
518
  assert_raises{ subject.withblock(1) }
527
519
  end
528
-
529
520
  end
530
521
 
531
522
  class DelegateClassTests < SystemTests
@@ -599,7 +590,6 @@ class Assert::Stub
599
590
 
600
591
  assert_nothing_raised{ subject.withblock(1) }
601
592
  end
602
-
603
593
  end
604
594
 
605
595
  class DelegateInstanceTests < SystemTests
@@ -673,7 +663,6 @@ class Assert::Stub
673
663
 
674
664
  assert_nothing_raised{ subject.withblock(1) }
675
665
  end
676
-
677
666
  end
678
667
 
679
668
  class ParentAndChildClassTests < SystemTests
@@ -690,11 +679,9 @@ class Assert::Stub
690
679
  assert_equal "parent", @parent_class.new
691
680
  assert_equal "child", @child_class.new
692
681
  end
693
-
694
682
  end
695
683
 
696
684
  class TestClass
697
-
698
685
  def self.noargs; end
699
686
  def self.withargs(a); end
700
687
  def self.anyargs(*args); end
@@ -706,27 +693,22 @@ class Assert::Stub
706
693
  def anyargs(*args); end
707
694
  def minargs(a, b, *args); end
708
695
  def withblock(&block); end
709
-
710
696
  end
711
697
 
712
698
  module TestModule
713
-
714
699
  def self.noargs; end
715
700
  def self.withargs(a); end
716
701
  def self.anyargs(*args); end
717
702
  def self.minargs(a, b, *args); end
718
703
  def self.withblock(&block); end
719
-
720
704
  end
721
705
 
722
706
  module TestMixin
723
-
724
707
  def noargs; end
725
708
  def withargs(a); end
726
709
  def anyargs(*args); end
727
710
  def minargs(a, b, *args); end
728
711
  def withblock(&block); end
729
-
730
712
  end
731
713
 
732
714
  class DelegateClass
@@ -750,5 +732,4 @@ class Assert::Stub
750
732
  @delegate.respond_to?(name) ? @delegate.send(name, *args, &block) : super
751
733
  end
752
734
  end
753
-
754
735
  end