assert 2.4.0 → 2.5.0
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.
- data/README.md +8 -8
- data/lib/assert.rb +9 -62
- data/lib/assert/assert_runner.rb +15 -30
- data/lib/assert/assertions.rb +105 -41
- data/lib/assert/cli.rb +1 -1
- data/lib/assert/config.rb +56 -0
- data/lib/assert/context.rb +44 -150
- data/lib/assert/context/setup_dsl.rb +70 -0
- data/lib/assert/context/subject_dsl.rb +39 -0
- data/lib/assert/context/suite_dsl.rb +20 -0
- data/lib/assert/context/test_dsl.rb +51 -0
- data/lib/assert/runner.rb +8 -2
- data/lib/assert/suite.rb +33 -12
- data/lib/assert/test.rb +11 -8
- data/lib/assert/utils.rb +23 -11
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view.rb +9 -7
- data/lib/assert/view/base.rb +26 -4
- data/lib/assert/view/default_view.rb +1 -1
- data/lib/assert/view/helpers/ansi_styles.rb +1 -1
- data/lib/assert/view/helpers/common.rb +16 -6
- data/test/helper.rb +1 -94
- data/test/support/factory.rb +70 -0
- data/test/system/running_tests.rb +55 -28
- data/test/unit/assert_tests.rb +6 -33
- data/test/unit/assertions/assert_block_tests.rb +3 -3
- data/test/unit/assertions/assert_empty_tests.rb +6 -4
- data/test/unit/assertions/assert_equal_tests.rb +19 -22
- data/test/unit/assertions/assert_file_exists_tests.rb +6 -4
- data/test/unit/assertions/assert_includes_tests.rb +8 -4
- data/test/unit/assertions/assert_instance_of_tests.rb +8 -6
- data/test/unit/assertions/assert_kind_of_tests.rb +8 -5
- data/test/unit/assertions/assert_match_tests.rb +8 -4
- data/test/unit/assertions/assert_nil_tests.rb +6 -4
- data/test/unit/assertions/assert_raises_tests.rb +2 -2
- data/test/unit/assertions/assert_respond_to_tests.rb +7 -5
- data/test/unit/assertions/assert_same_tests.rb +75 -6
- data/test/unit/assertions/assert_true_false_tests.rb +116 -0
- data/test/unit/assertions_tests.rb +7 -5
- data/test/unit/config_tests.rb +58 -0
- data/test/unit/context/{setup_teardown_singleton_tests.rb → setup_dsl_tests.rb} +17 -19
- data/test/unit/context/subject_dsl_tests.rb +78 -0
- data/test/unit/context/suite_dsl_tests.rb +47 -0
- data/test/unit/context/{test_should_singleton_tests.rb → test_dsl_tests.rb} +33 -34
- data/test/unit/context_tests.rb +19 -15
- data/test/unit/runner_tests.rb +9 -3
- data/test/unit/suite_tests.rb +20 -23
- data/test/unit/test_tests.rb +22 -14
- data/test/unit/utils_tests.rb +15 -21
- data/test/unit/view_tests.rb +12 -5
- metadata +23 -10
- data/test/unit/context/basic_singleton_tests.rb +0 -86
@@ -9,11 +9,12 @@ module Assert::Assertions
|
|
9
9
|
desc "`assert_equal`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert equal fail desc"
|
12
|
-
|
12
|
+
a = @a = [ '1', '2', desc ]
|
13
13
|
@test = Factory.test do
|
14
|
-
assert_equal(1, 1)
|
15
|
-
assert_equal(*
|
14
|
+
assert_equal(1, 1) # pass
|
15
|
+
assert_equal(*a) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,7 +26,8 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@
|
29
|
+
exp = "#{@a[2]}\nExpected #{Assert::U.show(@a[1], @c)}"\
|
30
|
+
" to be equal to #{Assert::U.show(@a[0], @c)}."
|
29
31
|
assert_equal exp, subject.fail_results.first.message
|
30
32
|
end
|
31
33
|
|
@@ -35,11 +37,12 @@ module Assert::Assertions
|
|
35
37
|
desc "`assert_not_equal`"
|
36
38
|
setup do
|
37
39
|
desc = @desc = "assert not equal fail desc"
|
38
|
-
|
40
|
+
a = @a = [ '1', '1', desc ]
|
39
41
|
@test = Factory.test do
|
40
|
-
assert_not_equal(*
|
41
|
-
assert_not_equal(1, 2)
|
42
|
+
assert_not_equal(*a) # fail
|
43
|
+
assert_not_equal(1, 2) # pass
|
42
44
|
end
|
45
|
+
@c = @test.config
|
43
46
|
@test.run
|
44
47
|
end
|
45
48
|
subject{ @test }
|
@@ -51,8 +54,8 @@ module Assert::Assertions
|
|
51
54
|
end
|
52
55
|
|
53
56
|
should "have a fail message with custom and generic explanations" do
|
54
|
-
exp = "#{@
|
55
|
-
"
|
57
|
+
exp = "#{@a[2]}\nExpected #{Assert::U.show(@a[1], @c)}"\
|
58
|
+
" to not be equal to #{Assert::U.show(@a[0], @c)}."
|
56
59
|
assert_equal exp, subject.fail_results.first.message
|
57
60
|
end
|
58
61
|
|
@@ -64,18 +67,12 @@ module Assert::Assertions
|
|
64
67
|
@exp_obj = "I'm a\nstring"
|
65
68
|
@act_obj = "I am a \nstring"
|
66
69
|
|
67
|
-
@
|
68
|
-
@
|
70
|
+
@c = Factory.modes_off_config
|
71
|
+
@c.use_diff_proc(Assert::U.default_use_diff_proc)
|
72
|
+
@c.run_diff_proc(Assert::U.syscmd_diff_proc)
|
69
73
|
|
70
|
-
@
|
71
|
-
@
|
72
|
-
|
73
|
-
Assert.config.use_diff_proc(Assert::U.default_use_diff_proc)
|
74
|
-
Assert.config.run_diff_proc(Assert::U.syscmd_diff_proc)
|
75
|
-
end
|
76
|
-
teardown do
|
77
|
-
Assert.config.use_diff_proc(@orig_use_diff_proc)
|
78
|
-
Assert.config.run_diff_proc(@orig_run_diff_proc)
|
74
|
+
@exp_obj_show = Assert::U.show_for_diff(@exp_obj, @c)
|
75
|
+
@act_obj_show = Assert::U.show_for_diff(@act_obj, @c)
|
79
76
|
end
|
80
77
|
|
81
78
|
end
|
@@ -84,7 +81,7 @@ module Assert::Assertions
|
|
84
81
|
desc "`assert_equal`"
|
85
82
|
setup do
|
86
83
|
exp_obj, act_obj = @exp_obj, @act_obj
|
87
|
-
@test = Factory.test do
|
84
|
+
@test = Factory.test(@c) do
|
88
85
|
assert_equal(exp_obj, act_obj)
|
89
86
|
end
|
90
87
|
@test.run
|
@@ -103,7 +100,7 @@ module Assert::Assertions
|
|
103
100
|
desc "`assert_not_equal`"
|
104
101
|
setup do
|
105
102
|
exp_obj, act_obj = @exp_obj, @act_obj
|
106
|
-
@test = Factory.test do
|
103
|
+
@test = Factory.test(@c) do
|
107
104
|
assert_not_equal(exp_obj, exp_obj)
|
108
105
|
end
|
109
106
|
@test.run
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertFileExistsTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_file_exists`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert file exists empty fail desc"
|
12
12
|
args = @args = [ '/a/path/to/some/file/that/no/exists', desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_file_exists(__FILE__) # pass
|
15
15
|
assert_file_exists(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,14 +26,14 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0])} to exist."
|
29
|
+
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to exist."
|
29
30
|
assert_equal exp, subject.fail_results.first.message
|
30
31
|
end
|
31
32
|
|
32
33
|
end
|
33
34
|
|
34
35
|
class AssertNotFileExistsTests < Assert::Context
|
35
|
-
desc "
|
36
|
+
desc "`assert_not_file_exists`"
|
36
37
|
setup do
|
37
38
|
desc = @desc = "assert not file exists empty fail desc"
|
38
39
|
args = @args = [ __FILE__, desc ]
|
@@ -40,6 +41,7 @@ module Assert::Assertions
|
|
40
41
|
assert_not_file_exists('/a/path/to/some/file/that/no/exists') # pass
|
41
42
|
assert_not_file_exists(*args) # fail
|
42
43
|
end
|
44
|
+
@c = @test.config
|
43
45
|
@test.run
|
44
46
|
end
|
45
47
|
subject{ @test }
|
@@ -51,7 +53,7 @@ module Assert::Assertions
|
|
51
53
|
end
|
52
54
|
|
53
55
|
should "have a fail message with custom and generic explanations" do
|
54
|
-
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0])} to not exist."
|
56
|
+
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not exist."
|
55
57
|
assert_equal exp, subject.fail_results.first.message
|
56
58
|
end
|
57
59
|
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertIncludesTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_includes`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert includes fail desc"
|
12
12
|
args = @args = [ 2, [ 1 ], desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_includes(1, [ 1 ]) # pass
|
15
15
|
assert_includes(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -26,14 +27,15 @@ module Assert::Assertions
|
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
29
|
exp = "#{@args[2]}\n"\
|
29
|
-
"Expected #{Assert::U.show(@args[1]
|
30
|
+
"Expected #{Assert::U.show(@args[1], @c)}"\
|
31
|
+
" to include #{Assert::U.show(@args[0], @c)}."
|
30
32
|
assert_equal exp, subject.fail_results.first.message
|
31
33
|
end
|
32
34
|
|
33
35
|
end
|
34
36
|
|
35
37
|
class AssertNotIncluded < Assert::Context
|
36
|
-
desc "
|
38
|
+
desc "`assert_not_included`"
|
37
39
|
setup do
|
38
40
|
desc = @desc = "assert not included fail desc"
|
39
41
|
args = @args = [ 1, [ 1 ], desc ]
|
@@ -41,6 +43,7 @@ module Assert::Assertions
|
|
41
43
|
assert_not_included(2, [ 1 ]) # pass
|
42
44
|
assert_not_included(*args) # fail
|
43
45
|
end
|
46
|
+
@c = @test.config
|
44
47
|
@test.run
|
45
48
|
end
|
46
49
|
subject{ @test }
|
@@ -53,7 +56,8 @@ module Assert::Assertions
|
|
53
56
|
|
54
57
|
should "have a fail message with custom and generic explanations" do
|
55
58
|
exp = "#{@args[2]}\n"\
|
56
|
-
"Expected #{Assert::U.show(@args[1]
|
59
|
+
"Expected #{Assert::U.show(@args[1], @c)}"\
|
60
|
+
" to not include #{Assert::U.show(@args[0], @c)}."
|
57
61
|
assert_equal exp, subject.fail_results.first.message
|
58
62
|
end
|
59
63
|
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertInstanceOfTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_instance_of`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert instance of fail desc"
|
12
12
|
args = @args = [ Array, "object", desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_instance_of(String, "object") # pass
|
15
15
|
assert_instance_of(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,15 +26,15 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1])} (#{@args[1].class})
|
29
|
-
" be an instance of #{@args[0]}."
|
29
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
30
|
+
" to be an instance of #{@args[0]}."
|
30
31
|
assert_equal exp, subject.fail_results.first.message
|
31
32
|
end
|
32
33
|
|
33
34
|
end
|
34
35
|
|
35
36
|
class AssertNotInstanceOfTests < Assert::Context
|
36
|
-
desc "
|
37
|
+
desc "`assert_not_instance_of`"
|
37
38
|
setup do
|
38
39
|
desc = @desc = "assert not instance of fail desc"
|
39
40
|
args = @args = [ String, "object", desc ]
|
@@ -41,6 +42,7 @@ module Assert::Assertions
|
|
41
42
|
assert_not_instance_of(*args) # fail
|
42
43
|
assert_not_instance_of(Array, "object") # pass
|
43
44
|
end
|
45
|
+
@c = @test.config
|
44
46
|
@test.run
|
45
47
|
end
|
46
48
|
subject{ @test }
|
@@ -52,8 +54,8 @@ module Assert::Assertions
|
|
52
54
|
end
|
53
55
|
|
54
56
|
should "have a fail message with custom and generic explanations" do
|
55
|
-
exp = "#{@args[2]}\
|
56
|
-
" be an instance of #{@args[0]}."
|
57
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
58
|
+
" to not be an instance of #{@args[0]}."
|
57
59
|
assert_equal exp, subject.fail_results.first.message
|
58
60
|
end
|
59
61
|
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertKindOfTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_kind_of`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert kind of fail desc"
|
12
12
|
args = @args = [ Array, "object", desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_kind_of(String, "object") # pass
|
15
15
|
assert_kind_of(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,15 +26,15 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1])} (#{@args[1].class})
|
29
|
-
" be a kind of #{@args[0]}."
|
29
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
30
|
+
" to be a kind of #{@args[0]}."
|
30
31
|
assert_equal exp, subject.fail_results.first.message
|
31
32
|
end
|
32
33
|
|
33
34
|
end
|
34
35
|
|
35
36
|
class AssertNotKindOfTests < Assert::Context
|
36
|
-
desc "
|
37
|
+
desc "`assert_not_kind_of`"
|
37
38
|
setup do
|
38
39
|
desc = @desc = "assert not kind of fail desc"
|
39
40
|
args = @args = [ String, "object", desc ]
|
@@ -41,6 +42,7 @@ module Assert::Assertions
|
|
41
42
|
assert_not_kind_of(*args) # fail
|
42
43
|
assert_not_kind_of(Array, "object") # pass
|
43
44
|
end
|
45
|
+
@c = @test.config
|
44
46
|
@test.run
|
45
47
|
end
|
46
48
|
subject{ @test }
|
@@ -52,7 +54,8 @@ module Assert::Assertions
|
|
52
54
|
end
|
53
55
|
|
54
56
|
should "have a fail message with custom and generic explanations" do
|
55
|
-
exp = "#{@args[2]}\
|
57
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
58
|
+
" to not be a kind of #{@args[0]}."
|
56
59
|
assert_equal exp, subject.fail_results.first.message
|
57
60
|
end
|
58
61
|
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertMatchTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_match`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert match fail desc"
|
12
12
|
args = @args = [ "not", "a string", desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_match(/a/, "a string") # pass
|
15
15
|
assert_match(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,14 +26,15 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1]
|
29
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)}"\
|
30
|
+
" to match #{Assert::U.show(@args[0], @c)}."
|
29
31
|
assert_equal exp, subject.fail_results.first.message
|
30
32
|
end
|
31
33
|
|
32
34
|
end
|
33
35
|
|
34
36
|
class AssertNotMatchTests < Assert::Context
|
35
|
-
desc "
|
37
|
+
desc "`assert_not_match`"
|
36
38
|
setup do
|
37
39
|
desc = @desc = "assert not match fail desc"
|
38
40
|
args = @args = [ /a/, "a string", desc ]
|
@@ -40,6 +42,7 @@ module Assert::Assertions
|
|
40
42
|
assert_not_match(*args) # fail
|
41
43
|
assert_not_match("not", "a string") # pass
|
42
44
|
end
|
45
|
+
@c = @test.config
|
43
46
|
@test.run
|
44
47
|
end
|
45
48
|
subject{ @test }
|
@@ -51,7 +54,8 @@ module Assert::Assertions
|
|
51
54
|
end
|
52
55
|
|
53
56
|
should "have a fail message with custom and generic explanations" do
|
54
|
-
exp = "#{@args[2]}\
|
57
|
+
exp = "#{@args[2]}\nExpected #{Assert::U.show(@args[1], @c)}"\
|
58
|
+
" to not match #{Assert::U.show(@args[0], @c)}."
|
55
59
|
assert_equal exp, subject.fail_results.first.message
|
56
60
|
end
|
57
61
|
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertNilTests < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_nil`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert nil empty fail desc"
|
12
12
|
args = @args = [ 1, desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_nil(nil) # pass
|
15
15
|
assert_nil(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -25,14 +26,14 @@ module Assert::Assertions
|
|
25
26
|
end
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
|
-
exp = "#{@args[1]}\nExpected
|
29
|
+
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to be nil."
|
29
30
|
assert_equal exp, subject.fail_results.first.message
|
30
31
|
end
|
31
32
|
|
32
33
|
end
|
33
34
|
|
34
35
|
class AssertNotNilTests < Assert::Context
|
35
|
-
desc "
|
36
|
+
desc "`assert_not_nil`"
|
36
37
|
setup do
|
37
38
|
desc = @desc = "assert not nil empty fail desc"
|
38
39
|
args = @args = [ nil, desc ]
|
@@ -40,6 +41,7 @@ module Assert::Assertions
|
|
40
41
|
assert_not_nil(1) # pass
|
41
42
|
assert_not_nil(*args) # fail
|
42
43
|
end
|
44
|
+
@c = @test.config
|
43
45
|
@test.run
|
44
46
|
end
|
45
47
|
subject{ @test }
|
@@ -51,7 +53,7 @@ module Assert::Assertions
|
|
51
53
|
end
|
52
54
|
|
53
55
|
should "have a fail message with custom and generic explanations" do
|
54
|
-
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0])} to not be nil."
|
56
|
+
exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be nil."
|
55
57
|
assert_equal exp, subject.fail_results.first.message
|
56
58
|
end
|
57
59
|
|
@@ -4,7 +4,7 @@ require 'assert/assertions'
|
|
4
4
|
module Assert::Assertions
|
5
5
|
|
6
6
|
class AssertRaisesTests < Assert::Context
|
7
|
-
desc "
|
7
|
+
desc "`assert_raises`"
|
8
8
|
setup do
|
9
9
|
d = @d = "assert raises fail desc"
|
10
10
|
@test = Factory.test do
|
@@ -38,7 +38,7 @@ module Assert::Assertions
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class AssertNothingRaisedTests < Assert::Context
|
41
|
-
desc "
|
41
|
+
desc "`assert_nothing_raised`"
|
42
42
|
setup do
|
43
43
|
d = @d = "assert nothing raised fail desc"
|
44
44
|
@test = Factory.test do
|
@@ -6,7 +6,7 @@ require 'assert/utils'
|
|
6
6
|
module Assert::Assertions
|
7
7
|
|
8
8
|
class AssertRespondToTest < Assert::Context
|
9
|
-
desc "
|
9
|
+
desc "`assert_respond_to`"
|
10
10
|
setup do
|
11
11
|
desc = @desc = "assert respond to fail desc"
|
12
12
|
args = @args = [ :abs, "1", desc ]
|
@@ -14,6 +14,7 @@ module Assert::Assertions
|
|
14
14
|
assert_respond_to(:abs, 1) # pass
|
15
15
|
assert_respond_to(*args) # fail
|
16
16
|
end
|
17
|
+
@c = @test.config
|
17
18
|
@test.run
|
18
19
|
end
|
19
20
|
subject{ @test }
|
@@ -26,7 +27,7 @@ module Assert::Assertions
|
|
26
27
|
|
27
28
|
should "have a fail message with custom and generic explanations" do
|
28
29
|
exp = "#{@args[2]}\n"\
|
29
|
-
"Expected #{Assert::U.show(@args[1])} (#{@args[1].class})"\
|
30
|
+
"Expected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
30
31
|
" to respond to `#{@args[0]}`."
|
31
32
|
assert_equal exp, subject.fail_results.first.message
|
32
33
|
end
|
@@ -34,7 +35,7 @@ module Assert::Assertions
|
|
34
35
|
end
|
35
36
|
|
36
37
|
class AssertNotRespondToTests < Assert::Context
|
37
|
-
desc "
|
38
|
+
desc "`assert_not_respond_to`"
|
38
39
|
setup do
|
39
40
|
desc = @desc = "assert not respond to fail desc"
|
40
41
|
args = @args = [ :abs, 1, desc ]
|
@@ -42,6 +43,7 @@ module Assert::Assertions
|
|
42
43
|
assert_not_respond_to(*args) # fail
|
43
44
|
assert_not_respond_to(:abs, "1") # pass
|
44
45
|
end
|
46
|
+
@c = @test.config
|
45
47
|
@test.run
|
46
48
|
end
|
47
49
|
subject{ @test }
|
@@ -54,8 +56,8 @@ module Assert::Assertions
|
|
54
56
|
|
55
57
|
should "have a fail message with custom and generic explanations" do
|
56
58
|
exp = "#{@args[2]}\n"\
|
57
|
-
"#{Assert::U.show(@args[1])} (#{@args[1].class})"\
|
58
|
-
" not
|
59
|
+
"Expected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
|
60
|
+
" to not respond to `#{@args[0]}`."
|
59
61
|
assert_equal exp, subject.fail_results.first.message
|
60
62
|
end
|
61
63
|
|