assert 2.17.0 → 2.18.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.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/README.md +0 -4
- data/assert.gemspec +2 -3
- data/lib/assert.rb +0 -10
- data/lib/assert/assert_runner.rb +0 -3
- data/lib/assert/assertions.rb +0 -4
- 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 +0 -2
- 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 +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 +0 -6
- data/lib/assert/result.rb +2 -17
- data/lib/assert/runner.rb +0 -3
- data/lib/assert/stub.rb +0 -2
- 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 +0 -4
- data/test/support/factory.rb +0 -1
- data/test/support/inherited_stuff.rb +0 -2
- data/test/system/stub_tests.rb +0 -19
- data/test/system/test_tests.rb +0 -16
- data/test/unit/assert_tests.rb +0 -4
- data/test/unit/assertions/assert_block_tests.rb +0 -4
- data/test/unit/assertions/assert_empty_tests.rb +0 -3
- data/test/unit/assertions/assert_equal_tests.rb +0 -8
- data/test/unit/assertions/assert_file_exists_tests.rb +0 -3
- data/test/unit/assertions/assert_includes_tests.rb +0 -4
- data/test/unit/assertions/assert_instance_of_tests.rb +0 -4
- data/test/unit/assertions/assert_kind_of_tests.rb +0 -4
- data/test/unit/assertions/assert_match_tests.rb +0 -4
- data/test/unit/assertions/assert_nil_tests.rb +0 -4
- data/test/unit/assertions/assert_raises_tests.rb +2 -6
- data/test/unit/assertions/assert_respond_to_tests.rb +0 -4
- data/test/unit/assertions/assert_same_tests.rb +0 -7
- data/test/unit/assertions/assert_true_false_tests.rb +0 -6
- data/test/unit/assertions_tests.rb +0 -4
- data/test/unit/config_helpers_tests.rb +0 -3
- data/test/unit/config_tests.rb +0 -3
- data/test/unit/context/setup_dsl_tests.rb +0 -8
- data/test/unit/context/subject_dsl_tests.rb +0 -6
- data/test/unit/context/suite_dsl_tests.rb +0 -4
- data/test/unit/context/test_dsl_tests.rb +0 -3
- data/test/unit/context_info_tests.rb +0 -3
- data/test/unit/context_tests.rb +2 -18
- data/test/unit/default_runner_tests.rb +0 -3
- data/test/unit/default_suite_tests.rb +0 -3
- data/test/unit/factory_tests.rb +0 -3
- data/test/unit/file_line_tests.rb +0 -4
- data/test/unit/macro_tests.rb +0 -8
- data/test/unit/result_tests.rb +0 -13
- data/test/unit/runner_tests.rb +0 -7
- data/test/unit/suite_tests.rb +0 -4
- data/test/unit/test_tests.rb +0 -12
- data/test/unit/utils_tests.rb +0 -9
- data/test/unit/view_helpers_tests.rb +0 -6
- data/test/unit/view_tests.rb +0 -4
- metadata +8 -9
- data/tmp/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20bea593cdc98d699ba8e3cc3a946d178800c3e08afce5ccc19bc844851c8a1c
|
4
|
+
data.tar.gz: 3eb6857857d305066936768ff680d30449bb6ee2e5730805227ab0f8120465e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b54d007f1a3da01a789d9b5bf77fd8850fb21cb2997b41719c9ec88ad93ebe7a94a4b1874f85c81adc31c09818f5cdc44e20d39ea7488710a8bb09dba7562a
|
7
|
+
data.tar.gz: 17ce1c4d21f34fcb1b229c28fa5ff9685df1ab0a498116edcd5b8a637ba3cdb4e18e36813e957aa05dd113a22c96eca60ca9a9c5ecffc2484fd590b1bec5f56a
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,11 +8,9 @@
|
|
8
8
|
require "assert"
|
9
9
|
|
10
10
|
class MyTests < Assert::Context
|
11
|
-
|
12
11
|
test "something" do
|
13
12
|
assert_equal 1, 1
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
17
15
|
```
|
18
16
|
|
@@ -413,13 +411,11 @@ If you just want to disable this feature completely:
|
|
413
411
|
|
414
412
|
```ruby
|
415
413
|
Assert.configure do |config|
|
416
|
-
|
417
414
|
# run nothing if the `-c` flag is given
|
418
415
|
config.changed_proc Proc.new{ |config, test_paths| [] }
|
419
416
|
|
420
417
|
# run all test paths if the `-c` flag is given
|
421
418
|
config.changed_proc Proc.new{ |config, test_paths| test_paths }
|
422
|
-
|
423
419
|
end
|
424
420
|
```
|
425
421
|
|
data/assert.gemspec
CHANGED
@@ -18,9 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.required_ruby_version =
|
21
|
+
gem.required_ruby_version = "~> 2.4"
|
22
22
|
|
23
23
|
gem.add_dependency("much-factory", ["~> 0.1.0"])
|
24
|
-
gem.add_dependency("much-stub", ["~> 0.1.
|
25
|
-
|
24
|
+
gem.add_dependency("much-stub", ["~> 0.1.1"])
|
26
25
|
end
|
data/lib/assert.rb
CHANGED
@@ -9,7 +9,6 @@ require "assert/utils"
|
|
9
9
|
require "assert/view"
|
10
10
|
|
11
11
|
module Assert
|
12
|
-
|
13
12
|
def self.config; @config ||= Config.new; end
|
14
13
|
def self.configure; yield self.config if block_given?; end
|
15
14
|
|
@@ -21,14 +20,5 @@ module Assert
|
|
21
20
|
class Context
|
22
21
|
teardown{ Assert.unstub! }
|
23
22
|
end
|
24
|
-
|
25
23
|
end
|
26
24
|
|
27
|
-
# Kernel#caller_locations polyfill for pre ruby 2.0.0
|
28
|
-
if RUBY_VERSION =~ /\A1\..+/ && !Kernel.respond_to?(:caller_locations)
|
29
|
-
module Kernel
|
30
|
-
def caller_locations(start = 1, length = nil)
|
31
|
-
length ? caller[start, length] : caller[start..-1]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/assert/assert_runner.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require "assert/cli"
|
2
2
|
|
3
3
|
module Assert
|
4
|
-
|
5
4
|
class AssertRunner
|
6
5
|
USER_SETTINGS_FILE = ".assert/init.rb"
|
7
6
|
LOCAL_SETTINGS_FILE = ".assert.rb"
|
@@ -117,7 +116,5 @@ module Assert
|
|
117
116
|
end
|
118
117
|
|
119
118
|
def segment_regex(seg); /^#{seg}$|^#{seg}\/|\/#{seg}\/|\/#{seg}$/; end
|
120
|
-
|
121
119
|
end
|
122
|
-
|
123
120
|
end
|
data/lib/assert/assertions.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require "assert/utils"
|
2
2
|
|
3
3
|
module Assert
|
4
|
-
|
5
4
|
module Assertions
|
6
|
-
|
7
5
|
def assert_block(desc = nil)
|
8
6
|
assert(yield, desc){ "Expected block to return a true value." }
|
9
7
|
end
|
@@ -328,7 +326,5 @@ module Assert
|
|
328
326
|
super("exception not expected, but raised:")
|
329
327
|
end
|
330
328
|
end
|
331
|
-
|
332
329
|
end
|
333
|
-
|
334
330
|
end
|
data/lib/assert/cli.rb
CHANGED
@@ -4,9 +4,7 @@ require "assert/assert_runner"
|
|
4
4
|
require "assert/version"
|
5
5
|
|
6
6
|
module Assert
|
7
|
-
|
8
7
|
class CLI
|
9
|
-
|
10
8
|
def self.debug?(args)
|
11
9
|
args.include?("-d") || args.include?("--debug")
|
12
10
|
end
|
@@ -36,40 +34,29 @@ module Assert
|
|
36
34
|
def initialize(*args)
|
37
35
|
@args = args
|
38
36
|
@cli = CLIRB.new do
|
39
|
-
option "runner_seed", "use a given seed to run tests",
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
option "
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
option "
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
option "
|
58
|
-
|
59
|
-
|
60
|
-
option "profile", "output test profile info", {
|
61
|
-
:abbrev => "e"
|
62
|
-
}
|
63
|
-
option "verbose", "output verbose runtime test info", {
|
64
|
-
:abbrev => "v"
|
65
|
-
}
|
66
|
-
option "list", "list test files on $stdout", {
|
67
|
-
:abbrev => "l"
|
68
|
-
}
|
37
|
+
option "runner_seed", "use a given seed to run tests",
|
38
|
+
abbrev: "s", value: Integer
|
39
|
+
option "changed_only", "only run test files with changes",
|
40
|
+
abbrev: "c"
|
41
|
+
option "changed_ref", "reference for changes, use with `-c` opt",
|
42
|
+
abbrev: "r", value: ""
|
43
|
+
option "single_test", "only run the test on the given file/line",
|
44
|
+
abbrev: "t", value: ""
|
45
|
+
option "pp_objects", "pretty-print objects in fail messages",
|
46
|
+
abbrev: "p"
|
47
|
+
option "capture_output", "capture stdout and display in result details",
|
48
|
+
abbrev: "o"
|
49
|
+
option "halt_on_fail", "halt a test when it fails",
|
50
|
+
abbrev: "h"
|
51
|
+
option "profile", "output test profile info",
|
52
|
+
abbrev: "e"
|
53
|
+
option "verbose", "output verbose runtime test info",
|
54
|
+
abbrev: "v"
|
55
|
+
option "list", "list test files on $stdout",
|
56
|
+
abbrev: "l"
|
57
|
+
|
69
58
|
# show loaded test files, cli err backtraces, etc
|
70
|
-
option "debug", "run in debug mode",
|
71
|
-
:abbrev => "d"
|
72
|
-
}
|
59
|
+
option "debug", "run in debug mode", abbrev: "d"
|
73
60
|
end
|
74
61
|
end
|
75
62
|
|
@@ -100,7 +87,6 @@ module Assert
|
|
100
87
|
"Options:"\
|
101
88
|
"#{@cli}"
|
102
89
|
end
|
103
|
-
|
104
90
|
end
|
105
91
|
|
106
92
|
module RoundedMillisecondTime
|
@@ -111,7 +97,7 @@ module Assert
|
|
111
97
|
end
|
112
98
|
end
|
113
99
|
|
114
|
-
class CLIRB # Version 1.
|
100
|
+
class CLIRB # Version 1.1.0, https://github.com/redding/cli.rb
|
115
101
|
Error = Class.new(RuntimeError);
|
116
102
|
HelpExit = Class.new(RuntimeError); VersionExit = Class.new(RuntimeError)
|
117
103
|
attr_reader :argv, :args, :opts, :data
|
@@ -143,27 +129,25 @@ module Assert
|
|
143
129
|
class Option
|
144
130
|
attr_reader :name, :opt_name, :desc, :abbrev, :value, :klass, :parser_args
|
145
131
|
|
146
|
-
def initialize(name,
|
147
|
-
|
148
|
-
@
|
149
|
-
@value, @klass = gvalinfo(
|
132
|
+
def initialize(name, desc = nil, abbrev: nil, value: nil)
|
133
|
+
@name, @desc = name, desc || ""
|
134
|
+
@opt_name, @abbrev = parse_name_values(name, abbrev)
|
135
|
+
@value, @klass = gvalinfo(value)
|
150
136
|
@parser_args = if [TrueClass, FalseClass, NilClass].include?(@klass)
|
151
137
|
["-#{@abbrev}", "--[no-]#{@opt_name}", @desc]
|
152
138
|
else
|
153
|
-
["-#{@abbrev}", "--#{@opt_name}
|
139
|
+
["-#{@abbrev}", "--#{@opt_name} VALUE", @klass, @desc]
|
154
140
|
end
|
155
141
|
end
|
156
142
|
|
157
143
|
private
|
158
144
|
|
159
145
|
def parse_name_values(name, custom_abbrev)
|
160
|
-
[ (processed_name = name.to_s.strip.downcase)
|
146
|
+
[ (processed_name = name.to_s.strip.downcase).gsub("_", "-"),
|
161
147
|
custom_abbrev || processed_name.gsub(/[^a-z]/, "").chars.first || "a"
|
162
148
|
]
|
163
149
|
end
|
164
|
-
def gvalinfo(v); v.kind_of?(Class) ? [nil,
|
165
|
-
def gklass(k); k == Fixnum ? Integer : k; end
|
150
|
+
def gvalinfo(v); v.kind_of?(Class) ? [nil,v] : [v,v.class]; end
|
166
151
|
end
|
167
152
|
end
|
168
|
-
|
169
153
|
end
|
data/lib/assert/config.rb
CHANGED
@@ -5,9 +5,7 @@ require "assert/file_line"
|
|
5
5
|
require "assert/utils"
|
6
6
|
|
7
7
|
module Assert
|
8
|
-
|
9
8
|
class Config
|
10
|
-
|
11
9
|
def self.settings(*items)
|
12
10
|
items.each do |item|
|
13
11
|
define_method(item) do |*args|
|
@@ -78,7 +76,5 @@ module Assert
|
|
78
76
|
def single_test_file_path
|
79
77
|
self.single_test_file_line.file if self.single_test_file_line
|
80
78
|
end
|
81
|
-
|
82
79
|
end
|
83
|
-
|
84
80
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Assert
|
2
|
-
|
3
2
|
module ConfigHelpers
|
4
|
-
|
5
3
|
def runner; self.config.runner; end
|
6
4
|
def suite; self.config.suite; end
|
7
5
|
def view; self.config.view; end
|
@@ -77,7 +75,5 @@ module Assert
|
|
77
75
|
def get_rate(count, time)
|
78
76
|
time == 0 ? 0.0 : (count.to_f / time.to_f)
|
79
77
|
end
|
80
|
-
|
81
78
|
end
|
82
|
-
|
83
79
|
end
|
data/lib/assert/context.rb
CHANGED
@@ -10,7 +10,6 @@ require "assert/suite"
|
|
10
10
|
require "assert/utils"
|
11
11
|
|
12
12
|
module Assert
|
13
|
-
|
14
13
|
class Context
|
15
14
|
# put all logic in DSL methods to keep context instances pure for running tests
|
16
15
|
extend SetupDSL
|
@@ -190,6 +189,5 @@ module Assert
|
|
190
189
|
def __assert_config__
|
191
190
|
@__assert_config__
|
192
191
|
end
|
193
|
-
|
194
192
|
end
|
195
193
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Assert; end
|
2
2
|
class Assert::Context
|
3
|
-
|
4
3
|
module SetupDSL
|
5
|
-
|
6
4
|
def setup_once(&block)
|
7
5
|
self.suite.setup(&block)
|
8
6
|
end
|
@@ -70,7 +68,5 @@ class Assert::Context
|
|
70
68
|
# ... before the parent
|
71
69
|
self.superclass.run_teardowns(scope) if self.superclass.respond_to?(:run_teardowns)
|
72
70
|
end
|
73
|
-
|
74
71
|
end
|
75
|
-
|
76
72
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Assert; end
|
2
2
|
class Assert::Context
|
3
|
-
|
4
3
|
module SubjectDSL
|
5
|
-
|
6
4
|
# Add a piece of description text or return the full description for the context
|
7
5
|
def description(text = nil)
|
8
6
|
if text
|
@@ -31,7 +29,5 @@ class Assert::Context
|
|
31
29
|
def descriptions
|
32
30
|
@descriptions ||= []
|
33
31
|
end
|
34
|
-
|
35
32
|
end
|
36
|
-
|
37
33
|
end
|
@@ -5,9 +5,7 @@ require "assert/test"
|
|
5
5
|
|
6
6
|
module Assert; end
|
7
7
|
class Assert::Context
|
8
|
-
|
9
8
|
module TestDSL
|
10
|
-
|
11
9
|
def test(desc_or_macro, called_from = nil, first_caller = nil, &block)
|
12
10
|
if desc_or_macro.kind_of?(Assert::Macro)
|
13
11
|
instance_eval(&desc_or_macro)
|
@@ -50,7 +48,5 @@ class Assert::Context
|
|
50
48
|
test_eventually(desc_or_macro, called_from, first_caller || caller_locations.first, &block)
|
51
49
|
end
|
52
50
|
alias_method :should_skip, :should_eventually
|
53
|
-
|
54
51
|
end
|
55
|
-
|
56
52
|
end
|
data/lib/assert/context_info.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Assert
|
2
|
-
|
3
2
|
class ContextInfo
|
4
|
-
|
5
3
|
attr_reader :called_from, :klass, :file
|
6
4
|
|
7
5
|
def initialize(klass, called_from = nil, first_caller = nil)
|
@@ -13,7 +11,5 @@ module Assert
|
|
13
11
|
def test_name(name)
|
14
12
|
[klass.description.to_s, name.to_s].compact.reject(&:empty?).join(" ")
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
18
|
-
|
19
15
|
end
|
data/lib/assert/default_suite.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
require "assert/suite"
|
2
2
|
|
3
3
|
module Assert
|
4
|
-
|
5
4
|
# This is the default suite used by assert. In addition to the base suite
|
6
5
|
# behavior, it accumulates test/result counts in memory. This data is used
|
7
6
|
# by the runner/view for handling and presentation purposes.
|
8
|
-
|
9
7
|
class DefaultSuite < Assert::Suite
|
10
|
-
|
11
8
|
def initialize(config)
|
12
9
|
super
|
13
10
|
reset_run_data
|
@@ -53,7 +50,5 @@ module Assert
|
|
53
50
|
@skip_result_count = 0
|
54
51
|
@ignore_result_count = 0
|
55
52
|
end
|
56
|
-
|
57
53
|
end
|
58
|
-
|
59
54
|
end
|
data/lib/assert/default_view.rb
CHANGED
@@ -2,10 +2,8 @@ require "assert/view"
|
|
2
2
|
require "assert/view_helpers"
|
3
3
|
|
4
4
|
module Assert
|
5
|
-
|
6
5
|
# This is the default view used by assert. It renders ansi test output
|
7
6
|
# designed for terminal viewing.
|
8
|
-
|
9
7
|
class DefaultView < Assert::View
|
10
8
|
include Assert::ViewHelpers::Ansi
|
11
9
|
|
@@ -184,7 +182,5 @@ module Assert
|
|
184
182
|
end
|
185
183
|
end
|
186
184
|
end
|
187
|
-
|
188
185
|
end
|
189
|
-
|
190
186
|
end
|