rematch 3.1.0 → 3.2.1
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/LICENSE.txt +1 -1
- data/lib/minitest/rematch_plugin.rb +20 -6
- data/lib/rematch/store.rb +13 -0
- data/lib/rematch.rb +3 -3
- metadata +34 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 150055b455fefcd4f49e818c38c57241acc07afb1fa2ce70e22e35c9df9c19b8
|
|
4
|
+
data.tar.gz: 52eed7dc443edbc90bb932a48d019d7871fce611d07bff83f663c798716066b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62464af5e1e8f5b770f6a33014eda611d2ad6a835321fba1b9f717e9efad38db36dd5ddf2694b50321f6b2695a2bf191655285b2471a038d62765659d51c872a
|
|
7
|
+
data.tar.gz: bf035d5b5ffa367dded7aedb2177a09825476894498f3ab7f5050b9bc05487365e624fcaecc7d4c78b7f4f45e499594518e76b27192967ce75df4b82d690a41d
|
data/LICENSE.txt
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'rematch'
|
|
4
|
+
require 'minitest/spec'
|
|
4
5
|
|
|
5
6
|
# Implement the minitest plugin
|
|
6
7
|
module Minitest
|
|
@@ -23,7 +24,7 @@ module Minitest
|
|
|
23
24
|
def after_setup
|
|
24
25
|
super
|
|
25
26
|
@rematch = Rematch.new(path: method(name).source_location.first,
|
|
26
|
-
id:
|
|
27
|
+
id: "#{self.class.name}##{name}")
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -48,11 +49,24 @@ module Minitest
|
|
|
48
49
|
raise Minitest::Assertion, '[rematch] the value has been stored: remove the "store_" prefix to pass the test'
|
|
49
50
|
end
|
|
50
51
|
end
|
|
52
|
+
# Reopen the Minitest::Expectation class for Minitest 6 compatibility
|
|
53
|
+
# or use infect_an_assertion for Minitest 5
|
|
54
|
+
require 'minitest/spec'
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
if defined?(Expectations) && Expectations.respond_to?(:infect_an_assertion)
|
|
57
|
+
module Expectations # rubocop:disable Style/Documentation
|
|
58
|
+
infect_an_assertion :assert_rematch, :must_rematch
|
|
59
|
+
infect_an_assertion :store_assert_rematch, :store_must_rematch
|
|
60
|
+
end
|
|
61
|
+
else
|
|
62
|
+
class Expectation # rubocop:disable Style/Documentation
|
|
63
|
+
def must_rematch(key, *)
|
|
64
|
+
ctx.assert_rematch(key, target, *)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def store_must_rematch(key, *)
|
|
68
|
+
ctx.store_assert_rematch(key, target, *)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
57
71
|
end
|
|
58
72
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'yaml/store'
|
|
4
|
+
|
|
5
|
+
class Rematch
|
|
6
|
+
# Subclass of YAML::Store
|
|
7
|
+
class Store < YAML::Store
|
|
8
|
+
# Use unsafe load, because tests are trusted content
|
|
9
|
+
def load(content)
|
|
10
|
+
YAML.unsafe_load(content) || {}
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/rematch.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'yaml/store'
|
|
4
3
|
require 'fileutils'
|
|
4
|
+
require_relative 'rematch/store'
|
|
5
5
|
|
|
6
6
|
# Handles the key/value store for each test
|
|
7
7
|
class Rematch
|
|
8
|
-
VERSION = '3.1
|
|
8
|
+
VERSION = '3.2.1'
|
|
9
9
|
CONFIG = { ext: '.yaml' } # rubocop:disable Style/MutableConstant
|
|
10
10
|
|
|
11
11
|
@rebuild = false # rebuild the store?
|
|
@@ -29,7 +29,7 @@ class Rematch
|
|
|
29
29
|
def initialize(path:, id:)
|
|
30
30
|
store_path = "#{path}#{CONFIG[:ext]}"
|
|
31
31
|
self.class.check_rebuild(store_path)
|
|
32
|
-
@store =
|
|
32
|
+
@store = Store.new(store_path, true)
|
|
33
33
|
@id = id.tr('#: ', '_') # easier key string for clumsy yaml parsers/highlighters
|
|
34
34
|
end
|
|
35
35
|
|
metadata
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rematch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1
|
|
4
|
+
version: 3.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Domizio Demichelis
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: logger
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: pstore
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
13
40
|
description: Instead of copying and pasting large outputs or big ruby structures into
|
|
14
41
|
all the affected test files every time your code change, you can do it the easy
|
|
15
42
|
way, possibly saving many hours of boring maintenance work!
|
|
@@ -22,6 +49,7 @@ files:
|
|
|
22
49
|
- LICENSE.txt
|
|
23
50
|
- lib/minitest/rematch_plugin.rb
|
|
24
51
|
- lib/rematch.rb
|
|
52
|
+
- lib/rematch/store.rb
|
|
25
53
|
homepage: https://github.com/ddnexus/rematch
|
|
26
54
|
licenses:
|
|
27
55
|
- MIT
|
|
@@ -30,7 +58,6 @@ metadata:
|
|
|
30
58
|
homepage_uri: https://github.com/ddnexus/rematch
|
|
31
59
|
bug_tracker_uri: https://github.com/ddnexus/rematch/issues
|
|
32
60
|
changelog_uri: https://github.com/ddnexus/rematch/blob/master/CHANGELOG.md
|
|
33
|
-
post_install_message:
|
|
34
61
|
rdoc_options: []
|
|
35
62
|
require_paths:
|
|
36
63
|
- lib
|
|
@@ -38,15 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
38
65
|
requirements:
|
|
39
66
|
- - ">"
|
|
40
67
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '3.
|
|
68
|
+
version: '3.2'
|
|
42
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
70
|
requirements:
|
|
44
71
|
- - ">="
|
|
45
72
|
- !ruby/object:Gem::Version
|
|
46
73
|
version: '0'
|
|
47
74
|
requirements: []
|
|
48
|
-
rubygems_version: 3.
|
|
49
|
-
signing_key:
|
|
75
|
+
rubygems_version: 3.6.9
|
|
50
76
|
specification_version: 4
|
|
51
77
|
summary: Declutter your test files from large hardcoded data and update them automatically
|
|
52
78
|
when your code changes
|