assert 2.19.6 → 2.19.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/assert.gemspec +5 -5
- data/lib/assert/assert_runner.rb +10 -9
- data/lib/assert/cli.rb +58 -24
- data/lib/assert/clirb.rb +2 -2
- data/lib/assert/config_helpers.rb +4 -3
- data/lib/assert/context/setup_dsl.rb +1 -1
- data/lib/assert/context.rb +14 -12
- data/lib/assert/macros/methods.rb +4 -4
- data/lib/assert/stub.rb +14 -14
- data/lib/assert/test.rb +1 -1
- data/lib/assert/version.rb +1 -1
- data/lib/assert/view_helpers.rb +5 -4
- data/test/helper.rb +17 -19
- data/test/unit/assert_tests.rb +22 -20
- data/test/unit/assertions_tests.rb +6 -5
- data/test/unit/config_helpers_tests.rb +4 -3
- data/test/unit/context/test_dsl_tests.rb +24 -18
- data/test/unit/test_tests.rb +12 -9
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a985d479544e1c7df9b9413b6ccfddafc2984387810cb19a008920917819b2b
|
4
|
+
data.tar.gz: 63224cfdf2906cd778e927606b80fb652bf3ff1d1fbe6c61d9f042819c639d13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 139edc6b21b76c15954387b0bde124081dfae331f223ca3a3ef7979cc5a00521d9733ce45e0b4f5e7a3622b5c752d640837cb554ac7052ae0b47f2065b1ca429
|
7
|
+
data.tar.gz: 495cbb7d90fadeb8256abdfbd9f4821b9e740cae8800dbea5d402982d44a60f4cfacb8e6657d869eb6ea0d06c8cc342b6d952b56d8c83e72dc6cd35b6d49d15e
|
data/Gemfile
CHANGED
data/assert.gemspec
CHANGED
@@ -21,11 +21,11 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.required_ruby_version = "
|
24
|
+
gem.required_ruby_version = ">= 2.5"
|
25
25
|
|
26
|
-
gem.add_development_dependency("much-style-guide", ["~> 0.6.
|
26
|
+
gem.add_development_dependency("much-style-guide", ["~> 0.6.7"])
|
27
27
|
|
28
|
-
gem.add_dependency("much-factory", ["~> 0.2.
|
29
|
-
gem.add_dependency("much-not-given", ["~> 0.1.
|
30
|
-
gem.add_dependency("much-stub", ["~> 0.1.
|
28
|
+
gem.add_dependency("much-factory", ["~> 0.2.3"])
|
29
|
+
gem.add_dependency("much-not-given", ["~> 0.1.3"])
|
30
|
+
gem.add_dependency("much-stub", ["~> 0.1.9"])
|
31
31
|
end
|
data/lib/assert/assert_runner.rb
CHANGED
@@ -88,13 +88,14 @@ module Assert
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def lookup_test_files(test_paths)
|
91
|
-
file_paths =
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
91
|
+
file_paths =
|
92
|
+
if config.changed_only
|
93
|
+
changed_test_files(test_paths)
|
94
|
+
elsif config.single_test?
|
95
|
+
globbed_test_files([config.single_test_file_path])
|
96
|
+
else
|
97
|
+
globbed_test_files(test_paths)
|
98
|
+
end
|
98
99
|
|
99
100
|
file_paths.select{ |p| is_test_file?(p) }.sort
|
100
101
|
end
|
@@ -104,14 +105,14 @@ module Assert
|
|
104
105
|
end
|
105
106
|
|
106
107
|
def globbed_test_files(test_paths)
|
107
|
-
test_paths.
|
108
|
+
test_paths.reduce(Set.new) do |paths, path|
|
108
109
|
p = File.expand_path(path, Dir.pwd)
|
109
110
|
paths + Dir.glob("#{p}*") + Dir.glob("#{p}*/**/*")
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
114
|
def is_test_file?(path)
|
114
|
-
config.test_file_suffixes.
|
115
|
+
config.test_file_suffixes.reduce(false) do |result, suffix|
|
115
116
|
result || path =~ /#{suffix}$/
|
116
117
|
end
|
117
118
|
end
|
data/lib/assert/cli.rb
CHANGED
@@ -43,31 +43,65 @@ module Assert
|
|
43
43
|
|
44
44
|
def initialize(*args)
|
45
45
|
@args = args
|
46
|
-
@cli =
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
46
|
+
@cli =
|
47
|
+
CLIRB.new do
|
48
|
+
option(
|
49
|
+
"runner_seed",
|
50
|
+
"use a given seed to run tests",
|
51
|
+
abbrev: "s",
|
52
|
+
value: Integer,
|
53
|
+
)
|
54
|
+
option(
|
55
|
+
"changed_only",
|
56
|
+
"only run test files with changes",
|
57
|
+
abbrev: "c",
|
58
|
+
)
|
59
|
+
option(
|
60
|
+
"changed_ref",
|
61
|
+
"reference for changes, use with `-c` opt",
|
62
|
+
abbrev: "r",
|
63
|
+
value: "",
|
64
|
+
)
|
65
|
+
option(
|
66
|
+
"single_test",
|
67
|
+
"only run the test on the given file/line",
|
68
|
+
abbrev: "t",
|
69
|
+
value: "",
|
70
|
+
)
|
71
|
+
option(
|
72
|
+
"pp_objects",
|
73
|
+
"pretty-print objects in fail messages",
|
74
|
+
abbrev: "p",
|
75
|
+
)
|
76
|
+
option(
|
77
|
+
"capture_output",
|
78
|
+
"capture stdout and display in result details",
|
79
|
+
abbrev: "o",
|
80
|
+
)
|
81
|
+
option(
|
82
|
+
"halt_on_fail",
|
83
|
+
"halt a test when it fails",
|
84
|
+
abbrev: "h",
|
85
|
+
)
|
86
|
+
option(
|
87
|
+
"profile",
|
88
|
+
"output test profile info",
|
89
|
+
abbrev: "e",
|
90
|
+
)
|
91
|
+
option(
|
92
|
+
"verbose",
|
93
|
+
"output verbose runtime test info",
|
94
|
+
abbrev: "v",
|
95
|
+
)
|
96
|
+
option(
|
97
|
+
"list",
|
98
|
+
"list test files on $stdout",
|
99
|
+
abbrev: "l",
|
100
|
+
)
|
67
101
|
|
68
|
-
|
69
|
-
|
70
|
-
|
102
|
+
# show loaded test files, cli err backtraces, etc
|
103
|
+
option "debug", "run in debug mode", abbrev: "d"
|
104
|
+
end
|
71
105
|
end
|
72
106
|
|
73
107
|
def run
|
data/lib/assert/clirb.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Assert
|
2
|
-
class CLIRB # Version 1.
|
2
|
+
class CLIRB # Version 1.2.0, https://github.com/redding/cli.rb
|
3
3
|
Error = Class.new(RuntimeError);
|
4
4
|
HelpExit = Class.new(RuntimeError); VersionExit = Class.new(RuntimeError)
|
5
5
|
attr_reader :argv, :args, :opts, :data
|
@@ -16,7 +16,7 @@ module Assert
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def option(*args); @options << Option.new(*args); end
|
19
|
+
def option(*args, **kargs); @options << Option.new(*args, **kargs); end
|
20
20
|
def parse!(argv)
|
21
21
|
@args = (argv || []).dup.tap do |args_list|
|
22
22
|
begin; @parser.parse!(args_list)
|
@@ -100,9 +100,10 @@ module Assert
|
|
100
100
|
|
101
101
|
# return a list of result type symbols that have actually occurred
|
102
102
|
def ocurring_result_types
|
103
|
-
@result_types ||=
|
104
|
-
|
105
|
-
|
103
|
+
@result_types ||=
|
104
|
+
[:pass, :fail, :ignore, :skip, :error].select do |sym|
|
105
|
+
send("#{sym}_result_count") > 0
|
106
|
+
end
|
106
107
|
end
|
107
108
|
|
108
109
|
private
|
@@ -44,7 +44,7 @@ class Assert::Context
|
|
44
44
|
|
45
45
|
def run_arounds(scope, &run_block)
|
46
46
|
context_block =
|
47
|
-
arounds.compact.reverse.
|
47
|
+
arounds.compact.reverse.reduce(run_block) do |run_b, around_b|
|
48
48
|
Proc.new{ scope.instance_exec(run_b, &around_b) }
|
49
49
|
end
|
50
50
|
|
data/lib/assert/context.rb
CHANGED
@@ -37,13 +37,14 @@ module Assert
|
|
37
37
|
@__assert_with_bt__ = []
|
38
38
|
@__assert_pending__ = 0
|
39
39
|
|
40
|
-
@__assert_result_callback__ =
|
41
|
-
|
42
|
-
|
40
|
+
@__assert_result_callback__ =
|
41
|
+
proc do |result|
|
42
|
+
unless @__assert_with_bt__.empty?
|
43
|
+
result.set_with_bt(@__assert_with_bt__.dup)
|
44
|
+
end
|
45
|
+
result_callback.call(result)
|
46
|
+
result
|
43
47
|
end
|
44
|
-
result_callback.call(result)
|
45
|
-
result
|
46
|
-
end
|
47
48
|
end
|
48
49
|
|
49
50
|
# Check if the result is true. If so, create a new pass result, Otherwise
|
@@ -52,12 +53,13 @@ module Assert
|
|
52
53
|
if assertion
|
53
54
|
pass
|
54
55
|
else
|
55
|
-
what =
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
what =
|
57
|
+
if block_given?
|
58
|
+
yield
|
59
|
+
else
|
60
|
+
"Failed assert: assertion was "\
|
61
|
+
"`#{Assert::U.show(assertion, __assert_config__)}`."
|
62
|
+
end
|
61
63
|
fail(fail_message(desc, what))
|
62
64
|
end
|
63
65
|
end
|
@@ -77,7 +77,7 @@ module Assert::Macros
|
|
77
77
|
|
78
78
|
def have_writer(*methods)
|
79
79
|
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
80
|
-
writer_meths = methods.
|
80
|
+
writer_meths = methods.map{ |m| "#{m}=" }
|
81
81
|
writer_meths << called
|
82
82
|
have_instance_methods(*writer_meths)
|
83
83
|
end
|
@@ -85,7 +85,7 @@ module Assert::Macros
|
|
85
85
|
|
86
86
|
def not_have_writer(*methods)
|
87
87
|
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
88
|
-
writer_meths = methods.
|
88
|
+
writer_meths = methods.map{ |m| "#{m}=" }
|
89
89
|
writer_meths << called
|
90
90
|
not_have_instance_methods(*writer_meths)
|
91
91
|
end
|
@@ -93,7 +93,7 @@ module Assert::Macros
|
|
93
93
|
|
94
94
|
def have_accessor(*methods)
|
95
95
|
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
96
|
-
accessor_meths = methods.
|
96
|
+
accessor_meths = methods.map{ |m| [m, "#{m}="] }.flatten
|
97
97
|
accessor_meths << called
|
98
98
|
have_instance_methods(*accessor_meths)
|
99
99
|
end
|
@@ -101,7 +101,7 @@ module Assert::Macros
|
|
101
101
|
|
102
102
|
def not_have_accessor(*methods)
|
103
103
|
called = methods.last.is_a?(Array) ? methods.pop : caller_locations
|
104
|
-
accessor_meths = methods.
|
104
|
+
accessor_meths = methods.map{ |m| [m, "#{m}="] }.flatten
|
105
105
|
accessor_meths << called
|
106
106
|
not_have_instance_methods(*accessor_meths)
|
107
107
|
end
|
data/lib/assert/stub.rb
CHANGED
@@ -7,42 +7,42 @@ module Assert
|
|
7
7
|
MuchStub.stubs
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.stub(*
|
11
|
-
MuchStub.stub(*
|
10
|
+
def self.stub(*pargs, **kargs, &block)
|
11
|
+
MuchStub.stub(*pargs, **kargs, &block)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.stub_on_call(*
|
15
|
-
MuchStub.stub_on_call(*
|
14
|
+
def self.stub_on_call(*pargs, **kargs, &block)
|
15
|
+
MuchStub.stub_on_call(*pargs, **kargs, &block)
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.unstub(*
|
19
|
-
MuchStub.unstub(*
|
18
|
+
def self.unstub(*pargs, **kargs)
|
19
|
+
MuchStub.unstub(*pargs, **kargs)
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.unstub!
|
23
23
|
MuchStub.unstub!
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.stub_send(*
|
26
|
+
def self.stub_send(*pargs, **kargs, &block)
|
27
27
|
orig_caller = caller_locations
|
28
28
|
begin
|
29
|
-
MuchStub.stub_send(*
|
29
|
+
MuchStub.stub_send(*pargs, **kargs, &block)
|
30
30
|
rescue MuchStub::NotStubbedError => ex
|
31
31
|
ex.set_backtrace(orig_caller.map(&:to_s))
|
32
32
|
raise ex
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.stub_tap(*
|
37
|
-
MuchStub.tap(*
|
36
|
+
def self.stub_tap(*pargs, **kargs, &block)
|
37
|
+
MuchStub.tap(*pargs, **kargs, &block)
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.stub_tap_on_call(*
|
41
|
-
MuchStub.tap_on_call(*
|
40
|
+
def self.stub_tap_on_call(*pargs, **kargs, &block)
|
41
|
+
MuchStub.tap_on_call(*pargs, **kargs, &block)
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.stub_spy(*
|
45
|
-
MuchStub.spy(*
|
44
|
+
def self.stub_spy(*pargs, **kargs, &block)
|
45
|
+
MuchStub.spy(*pargs, **kargs, &block)
|
46
46
|
end
|
47
47
|
|
48
48
|
StubCall = MuchStub::Call
|
data/lib/assert/test.rb
CHANGED
@@ -83,7 +83,7 @@ module Assert
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def inspect
|
86
|
-
attributes_string = ([:name, :context_info].
|
86
|
+
attributes_string = ([:name, :context_info].map do |attr|
|
87
87
|
"@#{attr}=#{send(attr).inspect}"
|
88
88
|
end).join(" ")
|
89
89
|
"#<#{self.class}:#{"0x0%x" % (object_id << 1)} #{attributes_string}>"
|
data/lib/assert/version.rb
CHANGED
data/lib/assert/view_helpers.rb
CHANGED
@@ -78,10 +78,11 @@ module Assert
|
|
78
78
|
# if a block is given, yield each msg in the breakdown for custom
|
79
79
|
# formatting.
|
80
80
|
def results_summary_sentence
|
81
|
-
summaries =
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
summaries =
|
82
|
+
ocurring_result_types.map do |result_type|
|
83
|
+
summary_msg = result_summary_msg(result_type)
|
84
|
+
block_given? ? yield(summary_msg, result_type) : summary_msg
|
85
|
+
end
|
85
86
|
to_sentence(summaries)
|
86
87
|
end
|
87
88
|
end
|
data/test/helper.rb
CHANGED
@@ -19,30 +19,28 @@ module Assert::Test::TestHelpers
|
|
19
19
|
@run_callback = proc{ |result| @test_run_results << result }
|
20
20
|
end
|
21
21
|
end
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
private
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
26
|
+
def test_run_callback
|
27
|
+
@run_callback
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
def test_run_results(type = nil)
|
31
|
+
return @test_run_results if type.nil?
|
32
|
+
@test_run_results.select{ |r| r.type == type }
|
33
|
+
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def test_run_result_count(type = nil)
|
36
|
+
test_run_results(type).count
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
def test_run_result_messages
|
40
|
+
@test_run_results.map(&:message)
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
# rubocop:enable Lint/NestedMethodDefinition
|
43
|
+
def last_test_run_result
|
44
|
+
@test_run_results.last
|
47
45
|
end
|
48
46
|
end
|
data/test/unit/assert_tests.rb
CHANGED
@@ -101,11 +101,12 @@ module Assert
|
|
101
101
|
end
|
102
102
|
|
103
103
|
should "auto-unstub any stubs on teardown" do
|
104
|
-
context_class =
|
105
|
-
|
106
|
-
|
104
|
+
context_class =
|
105
|
+
::Factory.modes_off_context_class do
|
106
|
+
setup do
|
107
|
+
Assert.stub(+"1", :to_s){ "one" }
|
108
|
+
end
|
107
109
|
end
|
108
|
-
end
|
109
110
|
|
110
111
|
context_class.run_setups("scope")
|
111
112
|
assert_that(Assert.stubs.size).equals(1)
|
@@ -149,23 +150,24 @@ module Assert
|
|
149
150
|
end
|
150
151
|
|
151
152
|
should "be able to add a stubbed spy" do
|
152
|
-
myclass =
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
153
|
+
myclass =
|
154
|
+
Class.new do
|
155
|
+
def one
|
156
|
+
self
|
157
|
+
end
|
158
|
+
|
159
|
+
def two(_val)
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
def three
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
def ready?
|
168
|
+
false
|
169
|
+
end
|
167
170
|
end
|
168
|
-
end
|
169
171
|
myobj = myclass.new
|
170
172
|
|
171
173
|
spy =
|
@@ -65,11 +65,12 @@ module Assert::Assertions
|
|
65
65
|
end
|
66
66
|
|
67
67
|
should "have a custom ignore message for each helper in the constant" do
|
68
|
-
exp =
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
exp =
|
69
|
+
Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
|
70
|
+
"The assertion `#{helper}` is not supported."\
|
71
|
+
" Please use another assertion or the basic `assert`."
|
72
|
+
end
|
73
|
+
assert_that(test_run_results.map(&:message)).equals(exp)
|
73
74
|
end
|
74
75
|
end
|
75
76
|
end
|
@@ -154,9 +154,10 @@ module Assert::ConfigHelpers
|
|
154
154
|
result_count
|
155
155
|
end
|
156
156
|
|
157
|
-
exp =
|
158
|
-
|
159
|
-
|
157
|
+
exp =
|
158
|
+
result_types.select do |type_sym|
|
159
|
+
subject.send("#{type_sym}_result_count") > 0
|
160
|
+
end
|
160
161
|
assert_that(subject.ocurring_result_types).equals(exp)
|
161
162
|
end
|
162
163
|
end
|
@@ -36,9 +36,10 @@ module Assert::Context::TestDSL
|
|
36
36
|
"called" do
|
37
37
|
d, b = test_desc1, test_block1
|
38
38
|
context, test = build_eval_context{ test_eventually(d, &b) }
|
39
|
-
err =
|
40
|
-
|
41
|
-
|
39
|
+
err =
|
40
|
+
capture_err(Assert::Result::TestSkipped) do
|
41
|
+
context.instance_eval(&test.code)
|
42
|
+
end
|
42
43
|
|
43
44
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
44
45
|
assert_that(err.message).equals("TODO")
|
@@ -49,9 +50,10 @@ module Assert::Context::TestDSL
|
|
49
50
|
"called" do
|
50
51
|
d, b = test_desc1, test_block1
|
51
52
|
context, test = build_eval_context{ should_eventually(d, &b) }
|
52
|
-
err =
|
53
|
-
|
54
|
-
|
53
|
+
err =
|
54
|
+
capture_err(Assert::Result::TestSkipped) do
|
55
|
+
context.instance_eval(&test.code)
|
56
|
+
end
|
55
57
|
|
56
58
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
57
59
|
assert_that(err.message).equals("TODO")
|
@@ -61,9 +63,10 @@ module Assert::Context::TestDSL
|
|
61
63
|
should "skip with the msg \"TODO\" when `test` called with no block" do
|
62
64
|
d = test_desc1
|
63
65
|
context, test = build_eval_context{ test(d) } # no block passed
|
64
|
-
err =
|
65
|
-
|
66
|
-
|
66
|
+
err =
|
67
|
+
capture_err(Assert::Result::TestSkipped) do
|
68
|
+
context.instance_eval(&test.code)
|
69
|
+
end
|
67
70
|
|
68
71
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
69
72
|
assert_that(err.message).equals("TODO")
|
@@ -73,9 +76,10 @@ module Assert::Context::TestDSL
|
|
73
76
|
should "skip with the msg \"TODO\" when `should` called with no block" do
|
74
77
|
d = test_desc1
|
75
78
|
context, test = build_eval_context{ should(d) } # no block passed
|
76
|
-
err =
|
77
|
-
|
78
|
-
|
79
|
+
err =
|
80
|
+
capture_err(Assert::Result::TestSkipped) do
|
81
|
+
context.instance_eval(&test.code)
|
82
|
+
end
|
79
83
|
|
80
84
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
81
85
|
assert_that(err.message).equals("TODO")
|
@@ -86,9 +90,10 @@ module Assert::Context::TestDSL
|
|
86
90
|
"no block" do
|
87
91
|
d = test_desc1
|
88
92
|
context, test = build_eval_context{ test_eventually(d) } # no block given
|
89
|
-
err =
|
90
|
-
|
91
|
-
|
93
|
+
err =
|
94
|
+
capture_err(Assert::Result::TestSkipped) do
|
95
|
+
context.instance_eval(&test.code)
|
96
|
+
end
|
92
97
|
|
93
98
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
94
99
|
assert_that(err.message).equals("TODO")
|
@@ -99,9 +104,10 @@ module Assert::Context::TestDSL
|
|
99
104
|
"no block" do
|
100
105
|
d = test_desc1
|
101
106
|
context, test = build_eval_context{ should_eventually(d) }
|
102
|
-
err =
|
103
|
-
|
104
|
-
|
107
|
+
err =
|
108
|
+
capture_err(Assert::Result::TestSkipped) do
|
109
|
+
context.instance_eval(&test.code)
|
110
|
+
end
|
105
111
|
|
106
112
|
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
107
113
|
assert_that(err.message).equals("TODO")
|
data/test/unit/test_tests.rb
CHANGED
@@ -182,9 +182,10 @@ class Assert::Test
|
|
182
182
|
desc "when in halt-on-fail mode"
|
183
183
|
|
184
184
|
should "capture fail results" do
|
185
|
-
test =
|
186
|
-
|
187
|
-
|
185
|
+
test =
|
186
|
+
Factory.test("halt-on-fail test", context_info1) do
|
187
|
+
raise Assert::Result::TestFailure
|
188
|
+
end
|
188
189
|
test.run(&test_run_callback)
|
189
190
|
|
190
191
|
assert_failed(test)
|
@@ -264,9 +265,10 @@ class Assert::Test
|
|
264
265
|
include Assert::Test::TestHelpers
|
265
266
|
|
266
267
|
should "capture error results" do
|
267
|
-
test =
|
268
|
-
|
269
|
-
|
268
|
+
test =
|
269
|
+
Factory.test("error test", context_info1) do
|
270
|
+
raise StandardError, "WHAT"
|
271
|
+
end
|
270
272
|
test.run(&test_run_callback)
|
271
273
|
|
272
274
|
assert_errored(test)
|
@@ -304,9 +306,10 @@ class Assert::Test
|
|
304
306
|
|
305
307
|
class SignalExceptionHandlingTests < UnitTests
|
306
308
|
should "raise any signal exceptions and not capture as an error" do
|
307
|
-
test =
|
308
|
-
|
309
|
-
|
309
|
+
test =
|
310
|
+
Factory.test("signal test", context_info1) do
|
311
|
+
raise SignalException, "USR1"
|
312
|
+
end
|
310
313
|
|
311
314
|
assert_that{ test.run }.raises(SignalException)
|
312
315
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.19.
|
4
|
+
version: 2.19.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
8
8
|
- Collin Redding
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: much-style-guide
|
@@ -17,56 +17,56 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.6.
|
20
|
+
version: 0.6.7
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.6.
|
27
|
+
version: 0.6.7
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: much-factory
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.2.
|
34
|
+
version: 0.2.3
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.2.
|
41
|
+
version: 0.2.3
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: much-not-given
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.1.
|
48
|
+
version: 0.1.3
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.1.
|
55
|
+
version: 0.1.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: much-stub
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.1.
|
62
|
+
version: 0.1.9
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.1.
|
69
|
+
version: 0.1.9
|
70
70
|
description: Assertion style testing framework.
|
71
71
|
email:
|
72
72
|
- kelly@kellyredding.com
|
@@ -163,13 +163,13 @@ homepage: http://github.com/redding/assert
|
|
163
163
|
licenses:
|
164
164
|
- MIT
|
165
165
|
metadata: {}
|
166
|
-
post_install_message:
|
166
|
+
post_install_message:
|
167
167
|
rdoc_options: []
|
168
168
|
require_paths:
|
169
169
|
- lib
|
170
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- - "
|
172
|
+
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '2.5'
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -178,8 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
rubygems_version: 3.2.
|
182
|
-
signing_key:
|
181
|
+
rubygems_version: 3.2.29
|
182
|
+
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Assertion style testing framework.
|
185
185
|
test_files:
|