assert 2.16.5 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -7
  2. data/Gemfile +3 -1
  3. data/README.md +20 -20
  4. data/assert.gemspec +5 -3
  5. data/bin/assert +4 -4
  6. data/lib/assert.rb +8 -8
  7. data/lib/assert/assert_runner.rb +7 -7
  8. data/lib/assert/assertions.rb +5 -5
  9. data/lib/assert/cli.rb +35 -35
  10. data/lib/assert/config.rb +8 -8
  11. data/lib/assert/config_helpers.rb +6 -6
  12. data/lib/assert/context.rb +17 -17
  13. data/lib/assert/context/test_dsl.rb +5 -5
  14. data/lib/assert/context_info.rb +2 -2
  15. data/lib/assert/default_runner.rb +1 -1
  16. data/lib/assert/default_suite.rb +1 -1
  17. data/lib/assert/default_view.rb +8 -8
  18. data/lib/assert/factory.rb +1 -1
  19. data/lib/assert/macro.rb +1 -1
  20. data/lib/assert/macros/methods.rb +1 -1
  21. data/lib/assert/result.rb +17 -17
  22. data/lib/assert/runner.rb +12 -8
  23. data/lib/assert/stub.rb +1 -1
  24. data/lib/assert/suite.rb +3 -3
  25. data/lib/assert/test.rb +11 -11
  26. data/lib/assert/utils.rb +8 -8
  27. data/lib/assert/version.rb +1 -1
  28. data/lib/assert/view.rb +19 -19
  29. data/lib/assert/view_helpers.rb +6 -6
  30. data/test/helper.rb +2 -11
  31. data/test/support/factory.rb +6 -6
  32. data/test/system/stub_tests.rb +204 -204
  33. data/test/system/test_tests.rb +13 -13
  34. data/test/unit/assert_tests.rb +9 -9
  35. data/test/unit/assertions/assert_block_tests.rb +2 -2
  36. data/test/unit/assertions/assert_empty_tests.rb +6 -6
  37. data/test/unit/assertions/assert_equal_tests.rb +5 -5
  38. data/test/unit/assertions/assert_file_exists_tests.rb +6 -6
  39. data/test/unit/assertions/assert_includes_tests.rb +7 -7
  40. data/test/unit/assertions/assert_instance_of_tests.rb +5 -5
  41. data/test/unit/assertions/assert_kind_of_tests.rb +5 -5
  42. data/test/unit/assertions/assert_match_tests.rb +5 -5
  43. data/test/unit/assertions/assert_nil_tests.rb +5 -5
  44. data/test/unit/assertions/assert_raises_tests.rb +2 -2
  45. data/test/unit/assertions/assert_respond_to_tests.rb +5 -5
  46. data/test/unit/assertions/assert_same_tests.rb +13 -13
  47. data/test/unit/assertions/assert_true_false_tests.rb +7 -7
  48. data/test/unit/assertions_tests.rb +2 -2
  49. data/test/unit/config_helpers_tests.rb +5 -5
  50. data/test/unit/config_tests.rb +12 -12
  51. data/test/unit/context/setup_dsl_tests.rb +7 -7
  52. data/test/unit/context/subject_dsl_tests.rb +3 -3
  53. data/test/unit/context/suite_dsl_tests.rb +3 -3
  54. data/test/unit/context/test_dsl_tests.rb +8 -8
  55. data/test/unit/context_info_tests.rb +6 -6
  56. data/test/unit/context_tests.rb +16 -16
  57. data/test/unit/default_runner_tests.rb +3 -3
  58. data/test/unit/default_suite_tests.rb +3 -3
  59. data/test/unit/factory_tests.rb +3 -3
  60. data/test/unit/file_line_tests.rb +12 -12
  61. data/test/unit/macro_tests.rb +2 -2
  62. data/test/unit/result_tests.rb +18 -18
  63. data/test/unit/runner_tests.rb +9 -9
  64. data/test/unit/suite_tests.rb +5 -5
  65. data/test/unit/test_tests.rb +19 -19
  66. data/test/unit/utils_tests.rb +18 -18
  67. data/test/unit/view_helpers_tests.rb +15 -15
  68. data/test/unit/view_tests.rb +11 -11
  69. data/tmp/.gitkeep +0 -0
  70. metadata +46 -44
  71. data/.assert.rb +0 -3
  72. data/.gitignore +0 -19
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/assertions'
1
+ require "assert"
2
+ require "assert/assertions"
3
3
 
4
- require 'assert/utils'
4
+ require "assert/utils"
5
5
 
6
6
  module Assert::Assertions
7
7
 
@@ -11,7 +11,7 @@ module Assert::Assertions
11
11
  desc "`assert_true`"
12
12
  setup do
13
13
  desc = @desc = "assert true fail desc"
14
- args = @args = [ 'whatever', desc ]
14
+ args = @args = ["whatever", desc]
15
15
  @test = Factory.test do
16
16
  assert_true(true) # pass
17
17
  assert_true(*args) # fail
@@ -40,7 +40,7 @@ module Assert::Assertions
40
40
  desc "`assert_not_true`"
41
41
  setup do
42
42
  desc = @desc = "assert not true fail desc"
43
- args = @args = [ true, desc ]
43
+ args = @args = [true, desc]
44
44
  @test = Factory.test do
45
45
  assert_not_true(false) # pass
46
46
  assert_not_true(*args) # fail
@@ -69,7 +69,7 @@ module Assert::Assertions
69
69
  desc "`assert_false`"
70
70
  setup do
71
71
  desc = @desc = "assert false fail desc"
72
- args = @args = [ 'whatever', desc ]
72
+ args = @args = ["whatever", desc]
73
73
  @test = Factory.test do
74
74
  assert_false(false) # pass
75
75
  assert_false(*args) # fail
@@ -98,7 +98,7 @@ module Assert::Assertions
98
98
  desc "`assert_not_false`"
99
99
  setup do
100
100
  desc = @desc = "assert not false fail desc"
101
- args = @args = [ false, desc ]
101
+ args = @args = [false, desc]
102
102
  @test = Factory.test do
103
103
  assert_not_false(true) # pass
104
104
  assert_not_false(*args) # fail
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/assertions'
1
+ require "assert"
2
+ require "assert/assertions"
3
3
 
4
4
  module Assert::Assertions
5
5
 
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/config_helpers'
1
+ require "assert"
2
+ require "assert/config_helpers"
3
3
 
4
- require 'assert/config'
4
+ require "assert/config"
5
5
 
6
6
  module Assert::ConfigHelpers
7
7
 
@@ -99,7 +99,7 @@ module Assert::ConfigHelpers
99
99
  end
100
100
 
101
101
  should "know its formatted run time, test rate and result rate" do
102
- format = '%.6f'
102
+ format = "%.6f"
103
103
 
104
104
  run_time = Factory.float
105
105
  exp = format % run_time
@@ -118,7 +118,7 @@ module Assert::ConfigHelpers
118
118
  end
119
119
 
120
120
  should "know its formatted suite run time, test rate and result rate" do
121
- format = '%.6f'
121
+ format = "%.6f"
122
122
 
123
123
  exp = format % subject.config.suite.run_time
124
124
  assert_equal exp, subject.formatted_suite_run_time(format)
@@ -1,11 +1,11 @@
1
- require 'assert'
2
- require 'assert/config'
1
+ require "assert"
2
+ require "assert/config"
3
3
 
4
- require 'assert/default_runner'
5
- require 'assert/default_suite'
6
- require 'assert/default_view'
7
- require 'assert/file_line'
8
- require 'assert/runner'
4
+ require "assert/default_runner"
5
+ require "assert/default_suite"
6
+ require "assert/default_view"
7
+ require "assert/file_line"
8
+ require "assert/runner"
9
9
 
10
10
  class Assert::Config
11
11
 
@@ -32,9 +32,9 @@ class Assert::Config
32
32
  end
33
33
 
34
34
  should "default the test dir/helper/suffixes" do
35
- assert_equal 'test', subject.test_dir
36
- assert_equal 'helper.rb', subject.test_helper
37
- assert_equal ['_tests.rb', "_test.rb"], subject.test_file_suffixes
35
+ assert_equal "test", subject.test_dir
36
+ assert_equal "helper.rb", subject.test_helper
37
+ assert_equal ["_tests.rb", "_test.rb"], subject.test_file_suffixes
38
38
  end
39
39
 
40
40
  should "default the procs" do
@@ -75,7 +75,7 @@ class Assert::Config
75
75
  end
76
76
 
77
77
  should "know its single test file line" do
78
- exp = Assert::FileLine.parse(File.expand_path('', Dir.pwd))
78
+ exp = Assert::FileLine.parse(File.expand_path("", Dir.pwd))
79
79
  assert_equal exp, subject.single_test_file_line
80
80
 
81
81
  file_line_path = "#{Factory.path}_tests.rb:#{Factory.integer}"
@@ -86,7 +86,7 @@ class Assert::Config
86
86
  end
87
87
 
88
88
  should "know its single test file path" do
89
- exp = Assert::FileLine.parse(File.expand_path('', Dir.pwd)).file
89
+ exp = Assert::FileLine.parse(File.expand_path("", Dir.pwd)).file
90
90
  assert_equal exp, subject.single_test_file_path
91
91
 
92
92
  path = "#{Factory.path}_tests.rb"
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/context/setup_dsl'
1
+ require "assert"
2
+ require "assert/context/setup_dsl"
3
3
 
4
4
  module Assert::Context::SetupDSL
5
5
 
@@ -91,10 +91,10 @@ module Assert::Context::SetupDSL
91
91
  end
92
92
 
93
93
  should "run it's parent and it's own blocks in the correct order" do
94
- subject.send('run_setups', obj = @test_status_class.new)
94
+ subject.send("run_setups", obj = @test_status_class.new)
95
95
  assert_equal "the setup has been run with something", obj.setup_status
96
96
 
97
- subject.send('run_teardowns', obj = @test_status_class.new)
97
+ subject.send("run_teardowns", obj = @test_status_class.new)
98
98
  assert_equal "with something has been run the teardown", obj.teardown_status
99
99
  end
100
100
 
@@ -105,7 +105,7 @@ module Assert::Context::SetupDSL
105
105
  setup do
106
106
  @parent_class = Factory.modes_off_context_class do
107
107
  around do |block|
108
- self.out_status ||= ''
108
+ self.out_status ||= ""
109
109
  self.out_status += "p-around start, "
110
110
  block.call
111
111
  self.out_status += "p-around end."
@@ -132,8 +132,8 @@ module Assert::Context::SetupDSL
132
132
 
133
133
  should "run it's parent and it's own blocks in the correct order" do
134
134
  obj = @test_status_class.new
135
- subject.send('run_arounds', obj) do
136
- obj.instance_eval{ self.out_status += 'TEST, ' }
135
+ subject.send("run_arounds", obj) do
136
+ obj.instance_eval{ self.out_status += "TEST, " }
137
137
  end
138
138
 
139
139
  exp = "p-around start, c-around1 start, c-around2 start, "\
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/context/subject_dsl'
1
+ require "assert"
2
+ require "assert/context/subject_dsl"
3
3
 
4
4
  module Assert::Context::SubjectDSL
5
5
 
@@ -12,7 +12,7 @@ module Assert::Context::SubjectDSL
12
12
  class DescriptionsTests < UnitTests
13
13
  desc "`descriptions` method"
14
14
  setup do
15
- descs = @descs = [ "something amazing", "it really is" ]
15
+ descs = @descs = ["something amazing", "it really is"]
16
16
  @context_class = Factory.modes_off_context_class do
17
17
  descs.each{ |text| desc text }
18
18
  end
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/context/suite_dsl'
1
+ require "assert"
2
+ require "assert/context/suite_dsl"
3
3
 
4
- require 'assert/suite'
4
+ require "assert/suite"
5
5
 
6
6
  module Assert::Context::SuiteDSL
7
7
 
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/context/test_dsl'
1
+ require "assert"
2
+ require "assert/context/test_dsl"
3
3
 
4
4
  module Assert::Context::TestDSL
5
5
 
@@ -40,7 +40,7 @@ module Assert::Context::TestDSL
40
40
  end
41
41
 
42
42
  assert_equal 1, context.class.suite.tests_to_run_count
43
- assert_equal 'TODO', err.message
43
+ assert_equal "TODO", err.message
44
44
  assert_equal 1, err.backtrace.size
45
45
  end
46
46
 
@@ -52,7 +52,7 @@ module Assert::Context::TestDSL
52
52
  end
53
53
 
54
54
  assert_equal 1, context.class.suite.tests_to_run_count
55
- assert_equal 'TODO', err.message
55
+ assert_equal "TODO", err.message
56
56
  assert_equal 1, err.backtrace.size
57
57
  end
58
58
 
@@ -64,7 +64,7 @@ module Assert::Context::TestDSL
64
64
  end
65
65
 
66
66
  assert_equal 1, context.class.suite.tests_to_run_count
67
- assert_equal 'TODO', err.message
67
+ assert_equal "TODO", err.message
68
68
  assert_equal 1, err.backtrace.size
69
69
  end
70
70
 
@@ -76,7 +76,7 @@ module Assert::Context::TestDSL
76
76
  end
77
77
 
78
78
  assert_equal 1, context.class.suite.tests_to_run_count
79
- assert_equal 'TODO', err.message
79
+ assert_equal "TODO", err.message
80
80
  assert_equal 1, err.backtrace.size
81
81
  end
82
82
 
@@ -88,7 +88,7 @@ module Assert::Context::TestDSL
88
88
  end
89
89
 
90
90
  assert_equal 1, context.class.suite.tests_to_run_count
91
- assert_equal 'TODO', err.message
91
+ assert_equal "TODO", err.message
92
92
  assert_equal 1, err.backtrace.size
93
93
  end
94
94
 
@@ -100,7 +100,7 @@ module Assert::Context::TestDSL
100
100
  end
101
101
 
102
102
  assert_equal 1, context.class.suite.tests_to_run_count
103
- assert_equal 'TODO', err.message
103
+ assert_equal "TODO", err.message
104
104
  assert_equal 1, err.backtrace.size
105
105
  end
106
106
 
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/context_info'
1
+ require "assert"
2
+ require "assert/context_info"
3
3
 
4
- require 'assert/context'
4
+ require "assert/context"
5
5
 
6
6
  class Assert::ContextInfo
7
7
 
@@ -30,7 +30,7 @@ class Assert::ContextInfo
30
30
  end
31
31
 
32
32
  should "set its file from caller info on init" do
33
- assert_equal @caller.first.gsub(/\:[0-9]+.*$/, ''), subject.file
33
+ assert_equal @caller.first.gsub(/\:[0-9]+.*$/, ""), subject.file
34
34
  end
35
35
 
36
36
  should "not have any file info if no caller is given" do
@@ -43,8 +43,8 @@ class Assert::ContextInfo
43
43
  name = Factory.string
44
44
 
45
45
  assert_equal name, subject.test_name(name)
46
- assert_equal '', subject.test_name('')
47
- assert_equal '', subject.test_name(nil)
46
+ assert_equal "", subject.test_name("")
47
+ assert_equal "", subject.test_name(nil)
48
48
 
49
49
  Assert.stub(subject.klass, :description){ desc }
50
50
  assert_equal "#{desc} #{name}", subject.test_name(name)
@@ -1,9 +1,9 @@
1
- require 'assert'
2
- require 'assert/context'
1
+ require "assert"
2
+ require "assert/context"
3
3
 
4
- require 'assert/config'
5
- require 'assert/result'
6
- require 'assert/utils'
4
+ require "assert/config"
5
+ require "assert/result"
6
+ require "assert/utils"
7
7
 
8
8
  class Assert::Context
9
9
 
@@ -43,7 +43,7 @@ class Assert::Context
43
43
  end
44
44
  private
45
45
 
46
- ASSERT_TEST_PATH_REGEX = /\A#{File.join(ROOT_PATH, 'test', '')}/
46
+ ASSERT_TEST_PATH_REGEX = /\A#{File.join(ROOT_PATH, "test", "")}/
47
47
 
48
48
  def assert_with_bt_set(exp_with_bt, result)
49
49
  with_backtrace(caller) do
@@ -212,7 +212,7 @@ class Assert::Context
212
212
  should "return a pass result given a `true` assertion" do
213
213
  result = subject.assert(true, @fail_desc){ @what_failed }
214
214
  assert_kind_of Assert::Result::Pass, result
215
- assert_equal '', result.message
215
+ assert_equal "", result.message
216
216
  end
217
217
 
218
218
  should "return a fail result given a `false` assertion" do
@@ -251,7 +251,7 @@ class Assert::Context
251
251
  should "return a pass result given a `false` assertion" do
252
252
  result = subject.assert_not(false, @fail_desc)
253
253
  assert_kind_of Assert::Result::Pass, result
254
- assert_equal '', result.message
254
+ assert_equal "", result.message
255
255
  end
256
256
 
257
257
  should "return a fail result given a `true` assertion" do
@@ -302,7 +302,7 @@ class Assert::Context
302
302
  end
303
303
 
304
304
  should "make fails skips and make passes fails" do
305
- @context.fail 'not affected'
305
+ @context.fail "not affected"
306
306
  @context.pass
307
307
  @context.pending(&@block1)
308
308
 
@@ -342,12 +342,12 @@ class Assert::Context
342
342
  class WithBacktraceTests < UnitTests
343
343
  desc "`with_backtrace` method"
344
344
  setup do
345
- @from_bt = ['called_from_here', Factory.string]
346
- @from_block = proc { ignore; fail; pass; skip 'todo'; }
345
+ @from_bt = ["called_from_here", Factory.string]
346
+ @from_block = proc { ignore; fail; pass; skip "todo"; }
347
347
  end
348
348
 
349
349
  should "alter non-error block results' bt with given bt's first line" do
350
- @context.fail 'not affected'
350
+ @context.fail "not affected"
351
351
  begin
352
352
  @context.with_backtrace(@from_bt, &@from_block)
353
353
  rescue Assert::Result::TestSkipped => e
@@ -371,15 +371,15 @@ class Assert::Context
371
371
  class WithNestedBacktraceTests < UnitTests
372
372
  desc "`with_backtrace` method nested"
373
373
  setup do
374
- @from_bt1 = ['called_from_here 1', Factory.string]
375
- @from_bt2 = from_bt2 = ['called_from_here 2', Factory.string]
374
+ @from_bt1 = ["called_from_here 1", Factory.string]
375
+ @from_bt2 = from_bt2 = ["called_from_here 2", Factory.string]
376
376
 
377
- from_block2 = proc { ignore; fail; pass; skip 'todo'; }
377
+ from_block2 = proc { ignore; fail; pass; skip "todo"; }
378
378
  @from_block1 = proc { with_backtrace(from_bt2, &from_block2) }
379
379
  end
380
380
 
381
381
  should "alter non-error block results' bt with nested wbt accrued first lines" do
382
- @context.fail 'not affected'
382
+ @context.fail "not affected"
383
383
  begin
384
384
  @context.with_backtrace(@from_bt1, &@from_block1)
385
385
  rescue Assert::Result::TestSkipped => e
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/default_runner'
1
+ require "assert"
2
+ require "assert/default_runner"
3
3
 
4
- require 'assert/runner'
4
+ require "assert/runner"
5
5
 
6
6
  class Assert::DefaultRunner
7
7
 
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/default_suite'
1
+ require "assert"
2
+ require "assert/default_suite"
3
3
 
4
- require 'assert/suite'
4
+ require "assert/suite"
5
5
 
6
6
  class Assert::DefaultSuite
7
7
 
@@ -1,7 +1,7 @@
1
- require 'assert'
2
- require 'assert/factory'
1
+ require "assert"
2
+ require "assert/factory"
3
3
 
4
- require 'much-factory'
4
+ require "much-factory"
5
5
 
6
6
  module Assert::Factory
7
7
 
@@ -1,5 +1,5 @@
1
- require 'assert'
2
- require 'assert/file_line'
1
+ require "assert"
2
+ require "assert/file_line"
3
3
 
4
4
  class Assert::FileLine
5
5
 
@@ -27,19 +27,19 @@ class Assert::FileLine
27
27
  should "handle parsing bad data gracefully" do
28
28
  file_line = subject.parse(@file)
29
29
  assert_equal @file, file_line.file
30
- assert_equal '', file_line.line
30
+ assert_equal "", file_line.line
31
31
 
32
32
  file_line = subject.parse(@line)
33
33
  assert_equal @line, file_line.file
34
- assert_equal '', file_line.line
34
+ assert_equal "", file_line.line
35
35
 
36
- file_line = subject.parse('')
37
- assert_equal '', file_line.file
38
- assert_equal '', file_line.line
36
+ file_line = subject.parse("")
37
+ assert_equal "", file_line.file
38
+ assert_equal "", file_line.line
39
39
 
40
40
  file_line = subject.parse(nil)
41
- assert_equal '', file_line.file
42
- assert_equal '', file_line.line
41
+ assert_equal "", file_line.file
42
+ assert_equal "", file_line.line
43
43
  end
44
44
 
45
45
  end
@@ -59,11 +59,11 @@ class Assert::FileLine
59
59
 
60
60
  file_line = Assert::FileLine.new(@file)
61
61
  assert_equal @file, file_line.file
62
- assert_equal '', file_line.line
62
+ assert_equal "", file_line.line
63
63
 
64
64
  file_line = Assert::FileLine.new
65
- assert_equal '', file_line.file
66
- assert_equal '', file_line.line
65
+ assert_equal "", file_line.file
66
+ assert_equal "", file_line.line
67
67
  end
68
68
 
69
69
  should "know its string representation" do