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