assert 2.16.5 → 2.18.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/Gemfile +3 -1
- data/README.md +79 -54
- data/assert.gemspec +6 -5
- data/bin/assert +4 -4
- data/lib/assert.rb +8 -18
- data/lib/assert/actual_value.rb +127 -0
- data/lib/assert/assert_runner.rb +7 -10
- data/lib/assert/assertions.rb +15 -28
- data/lib/assert/cli.rb +41 -57
- data/lib/assert/config.rb +8 -12
- data/lib/assert/config_helpers.rb +6 -10
- data/lib/assert/context.rb +30 -24
- data/lib/assert/context/let_dsl.rb +13 -0
- data/lib/assert/context/method_missing.rb +19 -0
- data/lib/assert/context/setup_dsl.rb +0 -4
- data/lib/assert/context/subject_dsl.rb +0 -4
- data/lib/assert/context/suite_dsl.rb +0 -4
- data/lib/assert/context/test_dsl.rb +5 -9
- data/lib/assert/context_info.rb +2 -6
- data/lib/assert/default_runner.rb +1 -5
- data/lib/assert/default_suite.rb +1 -6
- data/lib/assert/default_view.rb +8 -12
- data/lib/assert/factory.rb +1 -4
- data/lib/assert/file_line.rb +0 -4
- data/lib/assert/macro.rb +1 -4
- data/lib/assert/macros/methods.rb +5 -11
- data/lib/assert/result.rb +19 -34
- data/lib/assert/runner.rb +12 -11
- data/lib/assert/stub.rb +16 -2
- data/lib/assert/suite.rb +3 -7
- data/lib/assert/test.rb +13 -18
- data/lib/assert/utils.rb +8 -12
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view.rb +18 -21
- data/lib/assert/view_helpers.rb +6 -17
- data/log/{.gitkeep → .keep} +0 -0
- data/test/helper.rb +26 -41
- data/test/support/factory.rb +20 -6
- data/test/support/inherited_stuff.rb +0 -2
- data/test/system/stub_tests.rb +350 -354
- data/test/system/test_tests.rb +119 -133
- data/test/unit/actual_value_tests.rb +335 -0
- data/test/unit/assert_tests.rb +125 -52
- data/test/unit/assertions/assert_block_tests.rb +34 -37
- data/test/unit/assertions/assert_empty_tests.rb +38 -38
- data/test/unit/assertions/assert_equal_tests.rb +84 -86
- data/test/unit/assertions/assert_file_exists_tests.rb +37 -39
- data/test/unit/assertions/assert_includes_tests.rb +45 -46
- data/test/unit/assertions/assert_instance_of_tests.rb +39 -40
- data/test/unit/assertions/assert_kind_of_tests.rb +39 -40
- data/test/unit/assertions/assert_match_tests.rb +39 -40
- data/test/unit/assertions/assert_nil_tests.rb +35 -38
- data/test/unit/assertions/assert_raises_tests.rb +58 -62
- data/test/unit/assertions/assert_respond_to_tests.rb +41 -42
- data/test/unit/assertions/assert_same_tests.rb +94 -90
- data/test/unit/assertions/assert_true_false_tests.rb +67 -69
- data/test/unit/assertions_tests.rb +17 -19
- data/test/unit/config_helpers_tests.rb +41 -43
- data/test/unit/config_tests.rb +42 -46
- data/test/unit/context/let_dsl_tests.rb +10 -0
- data/test/unit/context/setup_dsl_tests.rb +72 -91
- data/test/unit/context/subject_dsl_tests.rb +18 -51
- data/test/unit/context/suite_dsl_tests.rb +19 -23
- data/test/unit/context/test_dsl_tests.rb +52 -59
- data/test/unit/context_info_tests.rb +19 -21
- data/test/unit/context_tests.rb +175 -178
- data/test/unit/default_runner_tests.rb +4 -10
- data/test/unit/default_suite_tests.rb +54 -59
- data/test/unit/factory_tests.rb +6 -9
- data/test/unit/file_line_tests.rb +34 -40
- data/test/unit/macro_tests.rb +11 -20
- data/test/unit/result_tests.rb +156 -182
- data/test/unit/runner_tests.rb +72 -79
- data/test/unit/suite_tests.rb +62 -63
- data/test/unit/test_tests.rb +143 -147
- data/test/unit/utils_tests.rb +49 -62
- data/test/unit/view_helpers_tests.rb +67 -70
- data/test/unit/view_tests.rb +26 -32
- metadata +54 -47
- data/.assert.rb +0 -3
- data/.gitignore +0 -19
@@ -1,124 +1,122 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "assert/assertions"
|
3
3
|
|
4
|
-
require
|
4
|
+
require "assert/utils"
|
5
5
|
|
6
6
|
module Assert::Assertions
|
7
|
-
|
8
7
|
class AssertTrueTests < Assert::Context
|
9
8
|
include Assert::Test::TestHelpers
|
10
9
|
|
11
10
|
desc "`assert_true`"
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
subject { test1 }
|
12
|
+
|
13
|
+
let(:desc1) { "assert true fail desc" }
|
14
|
+
let(:args1) { ["whatever", desc1] }
|
15
|
+
let(:test1) {
|
16
|
+
args = args1
|
17
|
+
Factory.test do
|
16
18
|
assert_true(true) # pass
|
17
19
|
assert_true(*args) # fail
|
18
20
|
end
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
subject{ @test }
|
21
|
+
}
|
22
|
+
let(:config1) { test1.config }
|
23
23
|
|
24
24
|
should "produce results as expected" do
|
25
|
-
|
26
|
-
assert_equal 1, test_run_result_count(:pass)
|
27
|
-
assert_equal 1, test_run_result_count(:fail)
|
28
|
-
end
|
25
|
+
subject.run(&test_run_callback)
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
27
|
+
assert_that(test_run_result_count).equals(2)
|
28
|
+
assert_that(test_run_result_count(:pass)).equals(1)
|
29
|
+
assert_that(test_run_result_count(:fail)).equals(1)
|
34
30
|
|
31
|
+
exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be true."
|
32
|
+
assert_that(test_run_results(:fail).first.message).equals(exp)
|
33
|
+
end
|
35
34
|
end
|
36
35
|
|
37
36
|
class AssertNotTrueTests < Assert::Context
|
38
37
|
include Assert::Test::TestHelpers
|
39
38
|
|
40
39
|
desc "`assert_not_true`"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
subject { test1 }
|
41
|
+
|
42
|
+
let(:desc1) { "assert not true fail desc" }
|
43
|
+
let(:args1) { [true, desc1] }
|
44
|
+
let(:test1) {
|
45
|
+
args = args1
|
46
|
+
Factory.test do
|
45
47
|
assert_not_true(false) # pass
|
46
48
|
assert_not_true(*args) # fail
|
47
49
|
end
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
subject{ @test }
|
50
|
+
}
|
51
|
+
let(:config1) { test1.config }
|
52
52
|
|
53
53
|
should "produce results as expected" do
|
54
|
-
|
55
|
-
assert_equal 1, test_run_result_count(:pass)
|
56
|
-
assert_equal 1, test_run_result_count(:fail)
|
57
|
-
end
|
54
|
+
subject.run(&test_run_callback)
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
56
|
+
assert_that(test_run_result_count).equals(2)
|
57
|
+
assert_that(test_run_result_count(:pass)).equals(1)
|
58
|
+
assert_that(test_run_result_count(:fail)).equals(1)
|
63
59
|
|
60
|
+
exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be true."
|
61
|
+
assert_that(test_run_results(:fail).first.message).equals(exp)
|
62
|
+
end
|
64
63
|
end
|
65
64
|
|
66
65
|
class AssertFalseTests < Assert::Context
|
67
66
|
include Assert::Test::TestHelpers
|
68
67
|
|
69
68
|
desc "`assert_false`"
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
subject { test1 }
|
70
|
+
|
71
|
+
let(:desc1) { "assert false fail desc" }
|
72
|
+
let(:args1) { ["whatever", desc1] }
|
73
|
+
let(:test1) {
|
74
|
+
args = args1
|
75
|
+
Factory.test do
|
74
76
|
assert_false(false) # pass
|
75
77
|
assert_false(*args) # fail
|
76
78
|
end
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
subject{ @test }
|
79
|
+
}
|
80
|
+
let(:config1) { test1.config }
|
81
81
|
|
82
82
|
should "produce results as expected" do
|
83
|
-
|
84
|
-
assert_equal 1, test_run_result_count(:pass)
|
85
|
-
assert_equal 1, test_run_result_count(:fail)
|
86
|
-
end
|
83
|
+
subject.run(&test_run_callback)
|
87
84
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
85
|
+
assert_that(test_run_result_count).equals(2)
|
86
|
+
assert_that(test_run_result_count(:pass)).equals(1)
|
87
|
+
assert_that(test_run_result_count(:fail)).equals(1)
|
92
88
|
|
89
|
+
exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be false."
|
90
|
+
assert_that(test_run_results(:fail).first.message).equals(exp)
|
91
|
+
end
|
93
92
|
end
|
94
93
|
|
95
94
|
class AssertNotFalseTests < Assert::Context
|
96
95
|
include Assert::Test::TestHelpers
|
97
96
|
|
98
97
|
desc "`assert_not_false`"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
subject { test1 }
|
99
|
+
|
100
|
+
let(:desc1) { "assert not false fail desc" }
|
101
|
+
let(:args1) { [false, desc1] }
|
102
|
+
let(:test1) {
|
103
|
+
args = args1
|
104
|
+
Factory.test do
|
103
105
|
assert_not_false(true) # pass
|
104
106
|
assert_not_false(*args) # fail
|
105
107
|
end
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
subject{ @test }
|
108
|
+
}
|
109
|
+
let(:config1) { test1.config }
|
110
110
|
|
111
111
|
should "produce results as expected" do
|
112
|
-
|
113
|
-
assert_equal 1, test_run_result_count(:pass)
|
114
|
-
assert_equal 1, test_run_result_count(:fail)
|
115
|
-
end
|
112
|
+
subject.run(&test_run_callback)
|
116
113
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
114
|
+
assert_that(test_run_result_count).equals(2)
|
115
|
+
assert_that(test_run_result_count(:pass)).equals(1)
|
116
|
+
assert_that(test_run_result_count(:fail)).equals(1)
|
121
117
|
|
118
|
+
exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be false."
|
119
|
+
assert_that(test_run_results(:fail).first.message).equals(exp)
|
120
|
+
end
|
122
121
|
end
|
123
|
-
|
124
122
|
end
|
@@ -1,18 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "assert/assertions"
|
3
3
|
|
4
4
|
module Assert::Assertions
|
5
|
-
|
6
5
|
class UnitTests < Assert::Context
|
7
6
|
include Assert::Test::TestHelpers
|
8
7
|
|
9
8
|
desc "Assert::Context"
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
subject{ @context }
|
9
|
+
subject { context1 }
|
10
|
+
|
11
|
+
let(:context_class1) { Factory.modes_off_context_class }
|
12
|
+
let(:test1) { Factory.test }
|
13
|
+
let(:context1) { context_class1.new(test1, test1.config, proc { |r| }) }
|
16
14
|
|
17
15
|
should have_imeths :assert_block, :assert_not_block, :refute_block
|
18
16
|
should have_imeths :assert_raises, :assert_not_raises
|
@@ -33,27 +31,29 @@ module Assert::Assertions
|
|
33
31
|
should have_imeths :assert_true, :assert_not_true, :refute_true
|
34
32
|
should have_imeths :assert_false, :assert_not_false, :refute_false
|
35
33
|
should have_imeths :assert_file_exists, :assert_not_file_exists, :refute_file_exists
|
36
|
-
|
37
34
|
end
|
38
35
|
|
39
36
|
class IgnoredTests < UnitTests
|
40
37
|
desc "ignored assertions helpers"
|
41
38
|
setup do
|
42
|
-
|
43
|
-
|
39
|
+
tests.each{ |test| test.run(&test_run_callback) }
|
40
|
+
end
|
41
|
+
|
42
|
+
let(:tests) {
|
43
|
+
context_info = Factory.context_info(context_class1)
|
44
|
+
Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
|
44
45
|
Factory.test("ignored assertion helper #{helper}", context_info) do
|
45
46
|
self.send(helper, "doesn't matter")
|
46
47
|
end
|
47
48
|
end
|
48
|
-
|
49
|
-
end
|
49
|
+
}
|
50
50
|
|
51
51
|
should "have an ignored result for each helper in the constant" do
|
52
52
|
exp = Assert::Assertions::IGNORED_ASSERTION_HELPERS.size
|
53
|
-
|
53
|
+
assert_that(test_run_result_count).equals(exp)
|
54
54
|
|
55
55
|
test_run_results.each do |result|
|
56
|
-
|
56
|
+
assert_that(result).is_kind_of(Assert::Result::Ignore)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -62,9 +62,7 @@ module Assert::Assertions
|
|
62
62
|
"The assertion `#{helper}` is not supported."\
|
63
63
|
" Please use another assertion or the basic `assert`."
|
64
64
|
end
|
65
|
-
|
65
|
+
assert_that(test_run_results.collect(&:message)).equals(exp)
|
66
66
|
end
|
67
|
-
|
68
67
|
end
|
69
|
-
|
70
68
|
end
|
@@ -1,14 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "assert/config_helpers"
|
3
3
|
|
4
|
-
require
|
4
|
+
require "assert/config"
|
5
5
|
|
6
6
|
module Assert::ConfigHelpers
|
7
|
-
|
8
7
|
class UnitTests < Assert::Context
|
9
8
|
desc "Assert::ConfigHelpers"
|
10
|
-
|
11
|
-
|
9
|
+
subject { helpers1 }
|
10
|
+
|
11
|
+
let(:helpers_class1) {
|
12
|
+
Class.new do
|
12
13
|
include Assert::ConfigHelpers
|
13
14
|
|
14
15
|
def config
|
@@ -17,9 +18,8 @@ module Assert::ConfigHelpers
|
|
17
18
|
@config ||= [Assert.config, Assert::Config.new].sample
|
18
19
|
end
|
19
20
|
end
|
20
|
-
|
21
|
-
|
22
|
-
subject{ @helpers }
|
21
|
+
}
|
22
|
+
let(:helpers1) { helpers_class1.new }
|
23
23
|
|
24
24
|
should have_imeths :runner, :suite, :view
|
25
25
|
should have_imeths :runner_seed, :single_test?, :single_test_file_line
|
@@ -35,107 +35,107 @@ module Assert::ConfigHelpers
|
|
35
35
|
should have_imeths :ocurring_result_types
|
36
36
|
|
37
37
|
should "know the config's runner, suite and view" do
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
assert_that(subject.runner).equals(subject.config.runner)
|
39
|
+
assert_that(subject.suite).equals(subject.config.suite)
|
40
|
+
assert_that(subject.view).equals(subject.config.view)
|
41
41
|
end
|
42
42
|
|
43
43
|
should "know its runner seed" do
|
44
|
-
|
44
|
+
assert_that(subject.runner_seed).equals(subject.config.runner_seed)
|
45
45
|
end
|
46
46
|
|
47
47
|
should "know if it is in single test mode" do
|
48
48
|
Assert.stub(subject.config, :single_test?){ true }
|
49
|
-
|
49
|
+
assert_that(subject.single_test?).is_true
|
50
50
|
|
51
51
|
Assert.stub(subject.config, :single_test?){ false }
|
52
|
-
|
52
|
+
assert_that(subject.single_test?).is_false
|
53
53
|
end
|
54
54
|
|
55
55
|
should "know its single test file line" do
|
56
56
|
exp = subject.config.single_test_file_line
|
57
|
-
|
57
|
+
assert_that(subject.single_test_file_line).equals(exp)
|
58
58
|
end
|
59
59
|
|
60
60
|
should "know its tests-to-run attrs" do
|
61
61
|
exp = subject.config.suite.tests_to_run?
|
62
|
-
|
62
|
+
assert_that(subject.tests_to_run?).equals(exp)
|
63
63
|
|
64
64
|
exp = subject.config.suite.tests_to_run_count
|
65
|
-
|
65
|
+
assert_that(subject.tests_to_run_count).equals(exp)
|
66
66
|
end
|
67
67
|
|
68
68
|
should "know its test/result counts" do
|
69
69
|
exp = subject.config.suite.test_count
|
70
|
-
|
70
|
+
assert_that(subject.test_count).equals(exp)
|
71
71
|
|
72
72
|
exp = subject.config.suite.result_count
|
73
|
-
|
73
|
+
assert_that(subject.result_count).equals(exp)
|
74
74
|
|
75
75
|
exp = subject.config.suite.pass_result_count
|
76
|
-
|
76
|
+
assert_that(subject.pass_result_count).equals(exp)
|
77
77
|
|
78
78
|
exp = subject.config.suite.fail_result_count
|
79
|
-
|
79
|
+
assert_that(subject.fail_result_count).equals(exp)
|
80
80
|
|
81
81
|
exp = subject.config.suite.error_result_count
|
82
|
-
|
82
|
+
assert_that(subject.error_result_count).equals(exp)
|
83
83
|
|
84
84
|
exp = subject.config.suite.skip_result_count
|
85
|
-
|
85
|
+
assert_that(subject.skip_result_count).equals(exp)
|
86
86
|
|
87
87
|
exp = subject.config.suite.ignore_result_count
|
88
|
-
|
88
|
+
assert_that(subject.ignore_result_count).equals(exp)
|
89
89
|
end
|
90
90
|
|
91
91
|
should "know if all tests are passing or not" do
|
92
92
|
result_count = Factory.integer
|
93
93
|
Assert.stub(subject, :result_count){ result_count }
|
94
94
|
Assert.stub(subject, :pass_result_count){ result_count }
|
95
|
-
|
95
|
+
assert_that(subject.all_pass?).is_true
|
96
96
|
|
97
97
|
Assert.stub(subject, :pass_result_count){ Factory.integer }
|
98
|
-
|
98
|
+
assert_that(subject.all_pass?).is_false
|
99
99
|
end
|
100
100
|
|
101
101
|
should "know its formatted run time, test rate and result rate" do
|
102
|
-
format =
|
102
|
+
format = "%.6f"
|
103
103
|
|
104
104
|
run_time = Factory.float
|
105
105
|
exp = format % run_time
|
106
|
-
|
107
|
-
|
106
|
+
assert_that(subject.formatted_run_time(run_time, format)).equals(exp)
|
107
|
+
assert_that(subject.formatted_run_time(run_time)).equals(exp)
|
108
108
|
|
109
109
|
test_rate = Factory.float
|
110
110
|
exp = format % test_rate
|
111
|
-
|
112
|
-
|
111
|
+
assert_that(subject.formatted_result_rate(test_rate, format)).equals(exp)
|
112
|
+
assert_that(subject.formatted_result_rate(test_rate)).equals(exp)
|
113
113
|
|
114
114
|
result_rate = Factory.float
|
115
115
|
exp = format % result_rate
|
116
|
-
|
117
|
-
|
116
|
+
assert_that(subject.formatted_result_rate(result_rate, format)).equals(exp)
|
117
|
+
assert_that(subject.formatted_result_rate(result_rate)).equals(exp)
|
118
118
|
end
|
119
119
|
|
120
120
|
should "know its formatted suite run time, test rate and result rate" do
|
121
|
-
format =
|
121
|
+
format = "%.6f"
|
122
122
|
|
123
123
|
exp = format % subject.config.suite.run_time
|
124
|
-
|
124
|
+
assert_that(subject.formatted_suite_run_time(format)).equals(exp)
|
125
125
|
|
126
126
|
exp = format % subject.config.suite.test_rate
|
127
|
-
|
127
|
+
assert_that(subject.formatted_suite_test_rate(format)).equals(exp)
|
128
128
|
|
129
129
|
exp = format % subject.config.suite.result_rate
|
130
|
-
|
130
|
+
assert_that(subject.formatted_suite_result_rate(format)).equals(exp)
|
131
131
|
end
|
132
132
|
|
133
133
|
should "know whether to show test profile info" do
|
134
|
-
|
134
|
+
assert_that(subject.show_test_profile_info?).equals(!!subject.config.profile)
|
135
135
|
end
|
136
136
|
|
137
137
|
should "know whether to show verbose info" do
|
138
|
-
|
138
|
+
assert_that(subject.show_test_verbose_info?).equals(!!subject.config.verbose)
|
139
139
|
end
|
140
140
|
|
141
141
|
should "know what result types occur in a suite's results" do
|
@@ -146,9 +146,7 @@ module Assert::ConfigHelpers
|
|
146
146
|
exp = result_types.select do |type_sym|
|
147
147
|
subject.send("#{type_sym}_result_count") > 0
|
148
148
|
end
|
149
|
-
|
149
|
+
assert_that(subject.ocurring_result_types).equals(exp)
|
150
150
|
end
|
151
|
-
|
152
151
|
end
|
153
|
-
|
154
152
|
end
|
data/test/unit/config_tests.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "assert/config"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
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
|
-
|
12
11
|
class UnitTests < Assert::Context
|
13
12
|
desc "Assert::Config"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
subject{ @config }
|
13
|
+
subject { config1 }
|
14
|
+
|
15
|
+
let(:config1) { Assert::Config.new }
|
18
16
|
|
19
17
|
should have_imeths :view, :suite, :runner
|
20
18
|
should have_imeths :test_dir, :test_helper, :test_file_suffixes
|
@@ -26,75 +24,73 @@ class Assert::Config
|
|
26
24
|
should have_imeths :single_test_file_line, :single_test_file_path
|
27
25
|
|
28
26
|
should "default the view, suite, and runner" do
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
assert_that(subject.view).is_kind_of(Assert::DefaultView)
|
28
|
+
assert_that(subject.suite).is_kind_of(Assert::DefaultSuite)
|
29
|
+
assert_that(subject.runner).is_kind_of(Assert::DefaultRunner)
|
32
30
|
end
|
33
31
|
|
34
32
|
should "default the test dir/helper/suffixes" do
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
assert_that(subject.test_dir).equals("test")
|
34
|
+
assert_that(subject.test_helper).equals("helper.rb")
|
35
|
+
assert_that(subject.test_file_suffixes).equals(["_tests.rb", "_test.rb"])
|
38
36
|
end
|
39
37
|
|
40
38
|
should "default the procs" do
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
assert_that(subject.changed_proc).is_not_nil
|
40
|
+
assert_that(subject.pp_proc).is_not_nil
|
41
|
+
assert_that(subject.use_diff_proc).is_not_nil
|
42
|
+
assert_that(subject.run_diff_proc).is_not_nil
|
45
43
|
end
|
46
44
|
|
47
45
|
should "default the option settings" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
46
|
+
assert_that(subject.runner_seed).is_not_nil
|
47
|
+
assert_that(subject.changed_only).is_false
|
48
|
+
assert_that(subject.changed_ref).is_empty
|
49
|
+
assert_that(subject.single_test).is_empty
|
50
|
+
assert_that(subject.pp_objects).is_false
|
51
|
+
assert_that(subject.capture_output).is_false
|
52
|
+
assert_that(subject.halt_on_fail).is_true
|
53
|
+
assert_that(subject.profile).is_false
|
54
|
+
assert_that(subject.verbose).is_false
|
55
|
+
assert_that(subject.list).is_false
|
56
|
+
assert_that(subject.debug).is_false
|
59
57
|
end
|
60
58
|
|
61
59
|
should "apply settings given from a hash" do
|
62
60
|
assert subject.halt_on_fail
|
63
61
|
subject.apply(:halt_on_fail => false)
|
64
|
-
|
62
|
+
assert_that(subject.halt_on_fail).is_false
|
65
63
|
|
66
|
-
|
67
|
-
|
64
|
+
assert_that(Assert::Config.new.halt_on_fail).is_true
|
65
|
+
assert_that(Assert::Config.new(:halt_on_fail => false).halt_on_fail).is_false
|
68
66
|
end
|
69
67
|
|
70
68
|
should "know if it is in single test mode" do
|
71
|
-
|
69
|
+
assert_that(subject.single_test?).is_false
|
72
70
|
|
73
71
|
subject.apply(:single_test => Factory.string)
|
74
|
-
|
72
|
+
assert_that(subject.single_test?).is_true
|
75
73
|
end
|
76
74
|
|
77
75
|
should "know its single test file line" do
|
78
|
-
exp = Assert::FileLine.parse(File.expand_path(
|
79
|
-
|
76
|
+
exp = Assert::FileLine.parse(File.expand_path("", Dir.pwd))
|
77
|
+
assert_that(subject.single_test_file_line).equals(exp)
|
80
78
|
|
81
79
|
file_line_path = "#{Factory.path}_tests.rb:#{Factory.integer}"
|
82
80
|
subject.apply(:single_test => file_line_path)
|
83
81
|
|
84
82
|
exp = Assert::FileLine.parse(File.expand_path(file_line_path, Dir.pwd))
|
85
|
-
|
83
|
+
assert_that(subject.single_test_file_line).equals(exp)
|
86
84
|
end
|
87
85
|
|
88
86
|
should "know its single test file path" do
|
89
|
-
exp = Assert::FileLine.parse(File.expand_path(
|
90
|
-
|
87
|
+
exp = Assert::FileLine.parse(File.expand_path("", Dir.pwd)).file
|
88
|
+
assert_that(subject.single_test_file_path).equals(exp)
|
91
89
|
|
92
90
|
path = "#{Factory.path}_tests.rb"
|
93
91
|
file_line_path = "#{path}:#{Factory.integer}"
|
94
92
|
subject.apply(:single_test => file_line_path)
|
95
|
-
|
93
|
+
assert_that(subject.single_test_file_path).equals(File.expand_path(path, Dir.pwd))
|
96
94
|
end
|
97
|
-
|
98
95
|
end
|
99
|
-
|
100
96
|
end
|