rematch 0.0.1 → 1.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/lib/minitest/rematch_plugin.rb +6 -1
- data/lib/rematch.rb +17 -3
- metadata +6 -8
- data/lib/rematch/tasks.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1813bfb1bfccc23e799726c867fd49509f9ae93935206a57a295259b5ca4533
|
4
|
+
data.tar.gz: f595fc1f3d2057969f68f8f2417831d7f22ff71d2abdff1341cd62df853b7e4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 907b7286d879fa6678598fcd60b1476b2e1f652cc4060bee23eaaab14b1a2dac7c3cbb6549e2391261e73ab9278e7276fbf00ee4fe2240ff6bd441436280f9eb
|
7
|
+
data.tar.gz: eb3ef411ce825152c59028f8cad7553971cdee632b252f43297acd3133241dc83cc5cedd683f208c5067c8eb748eb0cb144c4fd8ed72ef30ac49934140471171
|
@@ -4,10 +4,15 @@ require 'rematch'
|
|
4
4
|
|
5
5
|
# Implement the minitest plugin
|
6
6
|
module Minitest
|
7
|
+
def self.plugin_rematch_options(opts, _options)
|
8
|
+
opts.on '--rematch-refresh-only', 'ONLY Refresh the stored values with the current values' do
|
9
|
+
Rematch.refresh = true
|
10
|
+
end
|
11
|
+
end
|
7
12
|
class Test
|
8
13
|
def before_setup
|
9
|
-
@rematch = Rematch.new(path: method(name).source_location.first, id: location)
|
10
14
|
super
|
15
|
+
@rematch = Rematch.new(path: method(name).source_location.first, id: location)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
module Assertions
|
data/lib/rematch.rb
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'yaml/store'
|
4
|
-
require '
|
4
|
+
require 'fileutils'
|
5
5
|
|
6
6
|
# Implement the key/value store
|
7
7
|
class Rematch
|
8
|
-
VERSION = '
|
8
|
+
VERSION = '1.0'
|
9
9
|
EXT = '.rematch'
|
10
10
|
|
11
|
+
@refreshed = []
|
12
|
+
class << self
|
13
|
+
attr_accessor :refresh
|
14
|
+
|
15
|
+
def check_refresh(path)
|
16
|
+
return unless @refresh && !@refreshed.include?(path)
|
17
|
+
FileUtils.rm_f(path)
|
18
|
+
@refreshed << path
|
19
|
+
puts "Refresh #{path}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
11
23
|
# path and unique id of the test being run
|
12
24
|
def initialize(path:, id:)
|
13
|
-
|
25
|
+
path = "#{path}#{EXT}"
|
26
|
+
self.class.check_refresh(path)
|
27
|
+
@store = YAML::Store.new(path, true)
|
14
28
|
@id = id
|
15
29
|
@count = 0
|
16
30
|
end
|
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rematch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
your code changes
|
13
|
+
description: Declutter your test files from large hardcoded data and update them automatically
|
14
|
+
when your code changes
|
16
15
|
email:
|
17
16
|
- dd.nexus@gmail.com
|
18
17
|
executables: []
|
@@ -22,7 +21,6 @@ files:
|
|
22
21
|
- LICENSE.txt
|
23
22
|
- lib/minitest/rematch_plugin.rb
|
24
23
|
- lib/rematch.rb
|
25
|
-
- lib/rematch/tasks.rb
|
26
24
|
homepage: https://github.com/ddnexus/rematch
|
27
25
|
licenses:
|
28
26
|
- MIT
|
@@ -35,7 +33,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
33
|
requirements:
|
36
34
|
- - ">"
|
37
35
|
- !ruby/object:Gem::Version
|
38
|
-
version: '2.
|
36
|
+
version: '2.1'
|
39
37
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
@@ -45,5 +43,5 @@ requirements: []
|
|
45
43
|
rubygems_version: 3.2.15
|
46
44
|
signing_key:
|
47
45
|
specification_version: 4
|
48
|
-
summary: Rematch expected values with automatically stored values
|
46
|
+
summary: Rematch expected test values with automatically stored values
|
49
47
|
test_files: []
|
data/lib/rematch/tasks.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
|
5
|
-
class Rematch
|
6
|
-
module Tasks
|
7
|
-
extend Rake::DSL
|
8
|
-
namespace :rematch do
|
9
|
-
desc 'Delete all the rematch stores below the tree=/path/to/test/dir (or current tree if omitted)'
|
10
|
-
task :reset do
|
11
|
-
pattern = Pathname.new(ENV['tree'] || '').join('**','*.rematch')
|
12
|
-
Dir.glob(pattern).each { |f| File.delete(f) }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|