minitest-skip 0.0.1 → 0.0.2
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 +5 -5
- data/README.md +9 -1
- data/Rakefile +6 -0
- data/lib/minitest/skip_dsl.rb +14 -0
- data/lib/minitest/skip_plugin.rb +6 -1
- data/minitest-skip.gemspec +1 -1
- data/test/test_skip_dsl.rb +17 -0
- data/test/test_skip_methods.rb +5 -7
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d58ef5603272ebb1da3d8d993be21afb4e4e7eeefed265545a90090c93a5a36e
|
4
|
+
data.tar.gz: 0ba54cd05b6c1fac386c1ac3542090d89aa09b5bb9de7cb9c0a8b357dcfc0920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f80152d68a6a7cbfe14624d0db6ee35fce9d0775cdba46ef882c97204e750742b5966801c8a33d622e2e1ae56b23c8ba57bb835c1e9196a9eeb0e59f99f74fb5
|
7
|
+
data.tar.gz: 6f6fc98a1ff2310cd339d6bdf321313f9562d8c7e3b65f0368d7b75be682bf4d4cc6ede359b118de3a3ef028d045a320e4f5c19893c6014b2724bfd996f61787
|
data/README.md
CHANGED
@@ -55,6 +55,14 @@ end
|
|
55
55
|
|
56
56
|
```
|
57
57
|
|
58
|
+
Or you can use the `skip` macro (suggested by [@sgtFloyd](https://github.com/sgtFloyd)):
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
skip def test_something
|
62
|
+
# ...
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
58
66
|
## Installation
|
59
67
|
|
60
68
|
Add this line to your application's Gemfile:
|
@@ -71,7 +79,7 @@ Or install it yourself as:
|
|
71
79
|
|
72
80
|
$ gem install minitest-skip
|
73
81
|
|
74
|
-
And that's it! This is a Minitest plugin which means that it will be autoloaded.
|
82
|
+
And that's it! This is a Minitest plugin which means that it will be autoloaded. If you want to use `xit` and `xdescribe` methods, you also need to `require "minitest/skip_dsl"`.
|
75
83
|
|
76
84
|
## Contributing
|
77
85
|
|
data/Rakefile
CHANGED
data/lib/minitest/skip_dsl.rb
CHANGED
@@ -2,6 +2,9 @@ require 'minitest/spec'
|
|
2
2
|
|
3
3
|
module Minitest
|
4
4
|
module SkipDSL
|
5
|
+
|
6
|
+
# Exact copy of Minitest::Spec::DSL#it except that it creates a method
|
7
|
+
# that starts with `skip_`
|
5
8
|
def xit desc = "anonymous", &block
|
6
9
|
block ||= proc { skip "(no tests defined)" }
|
7
10
|
|
@@ -21,6 +24,8 @@ module Minitest
|
|
21
24
|
name
|
22
25
|
end
|
23
26
|
|
27
|
+
# Exact copy of Minitest::Spec::DSL#nuke_test_methods! except that it
|
28
|
+
# also undefines `skip_` methods
|
24
29
|
def nuke_test_methods! # :nodoc:
|
25
30
|
self.public_instance_methods.grep(/^test_|skip_/).each do |name|
|
26
31
|
self.send :undef_method, name
|
@@ -32,6 +37,8 @@ module Minitest
|
|
32
37
|
end
|
33
38
|
|
34
39
|
module Kernel
|
40
|
+
# Exact copy of Kernel#desribe except that it aliases `it` to `xit` for
|
41
|
+
# the class that is created
|
35
42
|
def xdescribe(desc, *additional_desc, &block)
|
36
43
|
stack = Minitest::Spec.describe_stack
|
37
44
|
name = [stack.last, desc, *additional_desc].compact.join("::")
|
@@ -52,3 +59,10 @@ module Kernel
|
|
52
59
|
|
53
60
|
private :xdescribe
|
54
61
|
end
|
62
|
+
|
63
|
+
class Minitest::Runnable
|
64
|
+
def self.skip(method_name)
|
65
|
+
undef_method(method_name)
|
66
|
+
define_method("skip_#{method_name}") {}
|
67
|
+
end
|
68
|
+
end
|
data/lib/minitest/skip_plugin.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
module Minitest
|
2
2
|
module SkipPlugin
|
3
|
+
# Patch runnable.run(reporter, options) so that it
|
4
|
+
# recognizes `skip_` methods and records them as skips
|
3
5
|
def run(reporter, options = {})
|
4
6
|
super
|
5
7
|
methods_matching(/^skip_/).each do |method_name|
|
6
|
-
|
8
|
+
# Minitest 5.13 added skip_until as a default method.
|
9
|
+
next if method_name == "skip_until"
|
10
|
+
|
11
|
+
test = new(method_name)
|
7
12
|
test.time = 0
|
8
13
|
|
9
14
|
skip = Skip.new("Skipped from SkipPlugin")
|
data/minitest-skip.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "minitest-skip"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Ivan Tse"]
|
9
9
|
spec.email = ["ivan.tse1@gmail.com"]
|
10
10
|
spec.summary = %q{Alternative ways to skip tests in Minitest}
|
data/test/test_skip_dsl.rb
CHANGED
@@ -53,4 +53,21 @@ class TestSkipDSL < Minitest::Test
|
|
53
53
|
|
54
54
|
assert_includes @output.string.dup, "4 runs, 1 assertions, 0 failures, 0 errors, 3 skips"
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_skip_macro
|
58
|
+
test = describe "Test" do
|
59
|
+
skip def test_something
|
60
|
+
assert false
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_something_else
|
64
|
+
assert false
|
65
|
+
end
|
66
|
+
skip :test_something_else
|
67
|
+
end
|
68
|
+
test.run(@reporter)
|
69
|
+
@reporter.report
|
70
|
+
|
71
|
+
assert_includes @output.string.dup, "2 runs, 0 assertions, 0 failures, 0 errors, 2 skips"
|
72
|
+
end
|
56
73
|
end
|
data/test/test_skip_methods.rb
CHANGED
@@ -32,12 +32,10 @@ class TestSkipMethods < Minitest::Test
|
|
32
32
|
@reporter.report
|
33
33
|
|
34
34
|
assert_includes @output.string.dup, "#skip_test_name = 0.00 s = S"
|
35
|
-
assert_includes @output.string.dup,
|
36
|
-
|
37
|
-
|
38
|
-
Skipped from SkipPlugin
|
39
|
-
EOM
|
40
|
-
|
35
|
+
assert_includes @output.string.dup, "1) Skipped:"
|
36
|
+
assert_includes @output.string.dup, "ExampleSkipTest#skip_test_name"
|
37
|
+
assert_includes @output.string.dup, "test/test_skip_methods.rb:8"
|
38
|
+
assert_includes @output.string.dup, "Skipped from SkipPlugin"
|
41
39
|
end
|
42
40
|
|
43
41
|
def test_skip_methods_are_recorded
|
@@ -47,7 +45,7 @@ class TestSkipMethods < Minitest::Test
|
|
47
45
|
assert result.skipped?
|
48
46
|
assert_equal Minitest::Skip, failure.error.class
|
49
47
|
assert_equal "Skipped from SkipPlugin", failure.error.message
|
50
|
-
|
48
|
+
assert_includes failure.location, "test/test_skip_methods.rb:8"
|
51
49
|
end
|
52
50
|
|
53
51
|
def test_skip_methods_are_not_executed
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-skip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Tse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,8 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
|
93
|
-
rubygems_version: 2.2.2
|
92
|
+
rubygems_version: 3.0.3
|
94
93
|
signing_key:
|
95
94
|
specification_version: 4
|
96
95
|
summary: Alternative ways to skip tests in Minitest
|