assert 2.18.3 → 2.18.4

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assert/context.rb +5 -2
  3. data/lib/assert/context/let_dsl.rb +3 -3
  4. data/lib/assert/context/subject_dsl.rb +23 -24
  5. data/lib/assert/version.rb +1 -1
  6. data/test/system/stub_tests.rb +101 -117
  7. data/test/system/test_tests.rb +21 -33
  8. data/test/unit/assert_tests.rb +3 -1
  9. data/test/unit/assertions/assert_block_tests.rb +6 -8
  10. data/test/unit/assertions/assert_empty_tests.rb +10 -12
  11. data/test/unit/assertions/assert_equal_tests.rb +12 -18
  12. data/test/unit/assertions/assert_file_exists_tests.rb +10 -12
  13. data/test/unit/assertions/assert_includes_tests.rb +10 -12
  14. data/test/unit/assertions/assert_instance_of_tests.rb +10 -12
  15. data/test/unit/assertions/assert_kind_of_tests.rb +10 -12
  16. data/test/unit/assertions/assert_match_tests.rb +10 -12
  17. data/test/unit/assertions/assert_nil_tests.rb +10 -12
  18. data/test/unit/assertions/assert_raises_tests.rb +6 -8
  19. data/test/unit/assertions/assert_respond_to_tests.rb +10 -12
  20. data/test/unit/assertions/assert_same_tests.rb +16 -22
  21. data/test/unit/assertions/assert_true_false_tests.rb +20 -24
  22. data/test/unit/assertions_tests.rb +1 -2
  23. data/test/unit/config_helpers_tests.rb +8 -4
  24. data/test/unit/config_tests.rb +7 -2
  25. data/test/unit/context/setup_dsl_tests.rb +3 -3
  26. data/test/unit/context/subject_dsl_tests.rb +1 -2
  27. data/test/unit/context/suite_dsl_tests.rb +1 -2
  28. data/test/unit/context_info_tests.rb +9 -2
  29. data/test/unit/context_tests.rb +65 -73
  30. data/test/unit/default_suite_tests.rb +8 -2
  31. data/test/unit/factory_tests.rb +3 -1
  32. data/test/unit/file_line_tests.rb +8 -8
  33. data/test/unit/macro_tests.rb +10 -5
  34. data/test/unit/result_tests.rb +34 -45
  35. data/test/unit/runner_tests.rb +10 -10
  36. data/test/unit/suite_tests.rb +9 -9
  37. data/test/unit/test_tests.rb +32 -39
  38. data/test/unit/utils_tests.rb +3 -1
  39. data/test/unit/view_helpers_tests.rb +6 -7
  40. data/test/unit/view_tests.rb +4 -3
  41. metadata +2 -2
@@ -8,18 +8,17 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_kind_of`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert kind of fail desc" }
14
- let(:args1) { [Array, "object", desc1] }
15
- let(:test1) {
11
+ subject {
16
12
  args = args1
17
13
  Factory.test do
18
14
  assert_kind_of(String, "object") # pass
19
15
  assert_kind_of(*args) # fail
20
16
  end
21
17
  }
22
- let(:config1) { test1.config }
18
+
19
+ let(:desc1) { "assert kind of fail desc" }
20
+ let(:args1) { [Array, "object", desc1] }
21
+ let(:config1) { subject.config }
23
22
 
24
23
  should "produce results as expected" do
25
24
  subject.run(&test_run_callback)
@@ -39,18 +38,17 @@ module Assert::Assertions
39
38
  include Assert::Test::TestHelpers
40
39
 
41
40
  desc "`assert_not_kind_of`"
42
- subject { test1 }
43
-
44
- let(:desc1) { "assert not kind of fail desc" }
45
- let(:args1) { [String, "object", desc1] }
46
- let(:test1) {
41
+ subject {
47
42
  args = args1
48
43
  Factory.test do
49
44
  assert_not_kind_of(*args) # fail
50
45
  assert_not_kind_of(Array, "object") # pass
51
46
  end
52
47
  }
53
- let(:config1) { test1.config }
48
+
49
+ let(:desc1) { "assert not kind of fail desc" }
50
+ let(:args1) { [String, "object", desc1] }
51
+ let(:config1) { subject.config }
54
52
 
55
53
  should "produce results as expected" do
56
54
  subject.run(&test_run_callback)
@@ -8,18 +8,17 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_match`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert match fail desc" }
14
- let(:args1) { ["not", "a string", desc1] }
15
- let(:test1) {
11
+ subject {
16
12
  args = args1
17
13
  Factory.test do
18
14
  assert_match(/a/, "a string") # pass
19
15
  assert_match(*args) # fail
20
16
  end
21
17
  }
22
- let(:config1) { test1.config }
18
+
19
+ let(:desc1) { "assert match fail desc" }
20
+ let(:args1) { ["not", "a string", desc1] }
21
+ let(:config1) { subject.config }
23
22
 
24
23
  should "produce results as expected" do
25
24
  subject.run(&test_run_callback)
@@ -39,18 +38,17 @@ module Assert::Assertions
39
38
  include Assert::Test::TestHelpers
40
39
 
41
40
  desc "`assert_not_match`"
42
- subject { test1 }
43
-
44
- let(:desc1) { "assert not match fail desc" }
45
- let(:args1) { [/a/, "a string", desc1] }
46
- let(:test1) {
41
+ subject {
47
42
  args = args1
48
43
  Factory.test do
49
44
  assert_not_match(*args) # fail
50
45
  assert_not_match("not", "a string") # pass
51
46
  end
52
47
  }
53
- let(:config1) { test1.config }
48
+
49
+ let(:desc1) { "assert not match fail desc" }
50
+ let(:args1) { [/a/, "a string", desc1] }
51
+ let(:config1) { subject.config }
54
52
 
55
53
  should "produce results as expected" do
56
54
  subject.run(&test_run_callback)
@@ -8,18 +8,17 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_nil`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert nil empty fail desc" }
14
- let(:args1) { [1, desc1] }
15
- let(:test1) {
11
+ subject {
16
12
  args = args1
17
13
  Factory.test do
18
14
  assert_nil(nil) # pass
19
15
  assert_nil(*args) # fail
20
16
  end
21
17
  }
22
- let(:config1) { test1.config }
18
+
19
+ let(:desc1) { "assert nil empty fail desc" }
20
+ let(:args1) { [1, desc1] }
21
+ let(:config1) { subject.config }
23
22
 
24
23
  should "produce results as expected" do
25
24
  subject.run(&test_run_callback)
@@ -37,18 +36,17 @@ module Assert::Assertions
37
36
  include Assert::Test::TestHelpers
38
37
 
39
38
  desc "`assert_not_nil`"
40
- subject { test1 }
41
-
42
- let(:desc1) { "assert not nil empty fail desc" }
43
- let(:args1) { [nil, desc1] }
44
- let(:test1) {
39
+ subject {
45
40
  args = args1
46
41
  Factory.test do
47
42
  assert_not_nil(1) # pass
48
43
  assert_not_nil(*args) # fail
49
44
  end
50
45
  }
51
- let(:config1) { test1.config }
46
+
47
+ let(:desc1) { "assert not nil empty fail desc" }
48
+ let(:args1) { [nil, desc1] }
49
+ let(:config1) { subject.config }
52
50
 
53
51
  should "produce results as expected" do
54
52
  subject.run(&test_run_callback)
@@ -6,10 +6,7 @@ module Assert::Assertions
6
6
  include Assert::Test::TestHelpers
7
7
 
8
8
  desc "`assert_raises`"
9
- subject { test1 }
10
-
11
- let(:desc1) { "assert raises fail desc" }
12
- let(:test1) {
9
+ subject {
13
10
  desc = desc1
14
11
  Factory.test do
15
12
  assert_raises(StandardError, RuntimeError) { raise(StandardError) } # pass
@@ -20,6 +17,8 @@ module Assert::Assertions
20
17
  end
21
18
  }
22
19
 
20
+ let(:desc1) { "assert raises fail desc" }
21
+
23
22
  should "produce results as expected" do
24
23
  subject.run(&test_run_callback)
25
24
 
@@ -62,10 +61,7 @@ module Assert::Assertions
62
61
  include Assert::Test::TestHelpers
63
62
 
64
63
  desc "`assert_nothing_raised`"
65
- subject { test1 }
66
-
67
- let(:desc1) { "assert nothing raised fail desc" }
68
- let(:test1) {
64
+ subject {
69
65
  desc = desc1
70
66
  Factory.test do
71
67
  assert_nothing_raised(StandardError, RuntimeError, desc) { raise(StandardError) } # fail
@@ -75,6 +71,8 @@ module Assert::Assertions
75
71
  end
76
72
  }
77
73
 
74
+ let(:desc1) { "assert nothing raised fail desc" }
75
+
78
76
  should "produce results as expected" do
79
77
  subject.run(&test_run_callback)
80
78
 
@@ -8,18 +8,17 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_respond_to`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert respond to fail desc" }
14
- let(:args1) { [:abs, "1", desc1] }
15
- let(:test1) {
11
+ subject {
16
12
  args = args1
17
13
  Factory.test do
18
14
  assert_respond_to(:abs, 1) # pass
19
15
  assert_respond_to(*args) # fail
20
16
  end
21
17
  }
22
- let(:config1) { test1.config }
18
+
19
+ let(:desc1) { "assert respond to fail desc" }
20
+ let(:args1) { [:abs, "1", desc1] }
21
+ let(:config1) { subject.config }
23
22
 
24
23
  should "produce results as expected" do
25
24
  subject.run(&test_run_callback)
@@ -40,18 +39,17 @@ module Assert::Assertions
40
39
  include Assert::Test::TestHelpers
41
40
 
42
41
  desc "`assert_not_respond_to`"
43
- subject { test1 }
44
-
45
- let(:desc1) { "assert not respond to fail desc" }
46
- let(:args1) { [:abs, 1, desc1] }
47
- let(:test1) {
42
+ subject {
48
43
  args = args1
49
44
  Factory.test do
50
45
  assert_not_respond_to(*args) # fail
51
46
  assert_not_respond_to(:abs, "1") # pass
52
47
  end
53
48
  }
54
- let(:config1) { test1.config }
49
+
50
+ let(:desc1) { "assert not respond to fail desc" }
51
+ let(:args1) { [:abs, 1, desc1] }
52
+ let(:config1) { subject.config }
55
53
 
56
54
  should "produce results as expected" do
57
55
  subject.run(&test_run_callback)
@@ -8,13 +8,7 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_same`"
11
- subject { test1 }
12
-
13
- let(:class1) { Class.new }
14
- let(:object1) { class1.new }
15
- let(:desc1) { "assert same fail desc" }
16
- let(:args1) { [object1, class1.new, desc1] }
17
- let(:test1) {
11
+ subject {
18
12
  args = args1
19
13
  object = object1
20
14
  Factory.test do
@@ -22,7 +16,12 @@ module Assert::Assertions
22
16
  assert_same(*args) # fail
23
17
  end
24
18
  }
25
- let(:config1) { test1.config }
19
+
20
+ let(:class1) { Class.new }
21
+ let(:object1) { class1.new }
22
+ let(:desc1) { "assert same fail desc" }
23
+ let(:args1) { [object1, class1.new, desc1] }
24
+ let(:config1) { subject.config }
26
25
 
27
26
  should "produce results as expected" do
28
27
  subject.run(&test_run_callback)
@@ -45,13 +44,7 @@ module Assert::Assertions
45
44
  include Assert::Test::TestHelpers
46
45
 
47
46
  desc "`assert_not_same`"
48
- subject { test1 }
49
-
50
- let(:class1) { Class.new }
51
- let(:object1) { class1.new }
52
- let(:desc1) { "assert not same fail desc" }
53
- let(:args1) { [object1, object1, desc1] }
54
- let(:test1) {
47
+ subject {
55
48
  args = args1
56
49
  object = object1
57
50
  klass = class1
@@ -60,7 +53,12 @@ module Assert::Assertions
60
53
  assert_not_same(object, klass.new) # pass
61
54
  end
62
55
  }
63
- let(:config1) { test1.config }
56
+
57
+ let(:class1) { Class.new }
58
+ let(:object1) { class1.new }
59
+ let(:desc1) { "assert not same fail desc" }
60
+ let(:args1) { [object1, object1, desc1] }
61
+ let(:config1) { subject.config }
64
62
 
65
63
  should "produce results as expected" do
66
64
  subject.run(&test_run_callback)
@@ -98,9 +96,7 @@ module Assert::Assertions
98
96
 
99
97
  class AssertSameDiffTests < DiffTests
100
98
  desc "`assert_same`"
101
- subject { test1 }
102
-
103
- let(:test1) {
99
+ subject {
104
100
  exp_obj, act_obj = exp_obj1, act_obj1
105
101
  Factory.test(config1) do
106
102
  assert_same(exp_obj, act_obj)
@@ -122,9 +118,7 @@ module Assert::Assertions
122
118
 
123
119
  class AssertNotSameDiffTests < DiffTests
124
120
  desc "`assert_not_same`"
125
- subject { test1 }
126
-
127
- let(:test1) {
121
+ subject {
128
122
  act_obj = act_obj1
129
123
  Factory.test(config1) do
130
124
  assert_not_same(act_obj, act_obj)
@@ -8,18 +8,17 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_true`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert true fail desc" }
14
- let(:args1) { ["whatever", desc1] }
15
- let(:test1) {
11
+ subject {
16
12
  args = args1
17
13
  Factory.test do
18
14
  assert_true(true) # pass
19
15
  assert_true(*args) # fail
20
16
  end
21
17
  }
22
- let(:config1) { test1.config }
18
+
19
+ let(:desc1) { "assert true fail desc" }
20
+ let(:args1) { ["whatever", desc1] }
21
+ let(:config1) { subject.config }
23
22
 
24
23
  should "produce results as expected" do
25
24
  subject.run(&test_run_callback)
@@ -37,18 +36,17 @@ module Assert::Assertions
37
36
  include Assert::Test::TestHelpers
38
37
 
39
38
  desc "`assert_not_true`"
40
- subject { test1 }
41
-
42
- let(:desc1) { "assert not true fail desc" }
43
- let(:args1) { [true, desc1] }
44
- let(:test1) {
39
+ subject {
45
40
  args = args1
46
41
  Factory.test do
47
42
  assert_not_true(false) # pass
48
43
  assert_not_true(*args) # fail
49
44
  end
50
45
  }
51
- let(:config1) { test1.config }
46
+
47
+ let(:desc1) { "assert not true fail desc" }
48
+ let(:args1) { [true, desc1] }
49
+ let(:config1) { subject.config }
52
50
 
53
51
  should "produce results as expected" do
54
52
  subject.run(&test_run_callback)
@@ -66,18 +64,17 @@ module Assert::Assertions
66
64
  include Assert::Test::TestHelpers
67
65
 
68
66
  desc "`assert_false`"
69
- subject { test1 }
70
-
71
- let(:desc1) { "assert false fail desc" }
72
- let(:args1) { ["whatever", desc1] }
73
- let(:test1) {
67
+ subject {
74
68
  args = args1
75
69
  Factory.test do
76
70
  assert_false(false) # pass
77
71
  assert_false(*args) # fail
78
72
  end
79
73
  }
80
- let(:config1) { test1.config }
74
+
75
+ let(:desc1) { "assert false fail desc" }
76
+ let(:args1) { ["whatever", desc1] }
77
+ let(:config1) { subject.config }
81
78
 
82
79
  should "produce results as expected" do
83
80
  subject.run(&test_run_callback)
@@ -95,18 +92,17 @@ module Assert::Assertions
95
92
  include Assert::Test::TestHelpers
96
93
 
97
94
  desc "`assert_not_false`"
98
- subject { test1 }
99
-
100
- let(:desc1) { "assert not false fail desc" }
101
- let(:args1) { [false, desc1] }
102
- let(:test1) {
95
+ subject {
103
96
  args = args1
104
97
  Factory.test do
105
98
  assert_not_false(true) # pass
106
99
  assert_not_false(*args) # fail
107
100
  end
108
101
  }
109
- let(:config1) { test1.config }
102
+
103
+ let(:desc1) { "assert not false fail desc" }
104
+ let(:args1) { [false, desc1] }
105
+ let(:config1) { subject.config }
110
106
 
111
107
  should "produce results as expected" do
112
108
  subject.run(&test_run_callback)
@@ -6,11 +6,10 @@ module Assert::Assertions
6
6
  include Assert::Test::TestHelpers
7
7
 
8
8
  desc "Assert::Context"
9
- subject { context1 }
9
+ subject { context_class1.new(test1, test1.config, proc { |r| }) }
10
10
 
11
11
  let(:context_class1) { Factory.modes_off_context_class }
12
12
  let(:test1) { Factory.test }
13
- let(:context1) { context_class1.new(test1, test1.config, proc { |r| }) }
14
13
 
15
14
  should have_imeths :assert_block, :assert_not_block, :refute_block
16
15
  should have_imeths :assert_raises, :assert_not_raises
@@ -6,20 +6,24 @@ require "assert/config"
6
6
  module Assert::ConfigHelpers
7
7
  class UnitTests < Assert::Context
8
8
  desc "Assert::ConfigHelpers"
9
- subject { helpers1 }
9
+ subject { unit_class }
10
10
 
11
- let(:helpers_class1) {
11
+ let(:unit_class) {
12
12
  Class.new do
13
13
  include Assert::ConfigHelpers
14
14
 
15
15
  def config
16
16
  # use the assert config since it has tests, contexts, etc
17
- # also maybe use a fresh config that is empty
17
+ # also use a fresh config that is empty
18
18
  @config ||= [Assert.config, Assert::Config.new].sample
19
19
  end
20
20
  end
21
21
  }
22
- let(:helpers1) { helpers_class1.new }
22
+ end
23
+
24
+ class InitTests < UnitTests
25
+ desc "when init"
26
+ subject { unit_class.new }
23
27
 
24
28
  should have_imeths :runner, :suite, :view
25
29
  should have_imeths :runner_seed, :single_test?, :single_test_file_line