minitest-holdify 1.0.0 → 1.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 +4 -4
- data/lib/holdify/store.rb +1 -1
- data/lib/holdify.rb +3 -3
- data/lib/minitest/holdify_plugin.rb +4 -4
- data/lib/minitest-holdify.rb +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a833738964de4fd5b67fbb6c68a1238e62077ed8716c4c37016e430234280a9
|
|
4
|
+
data.tar.gz: bf3e156990631e915295f4109b3bacd6f3e4553e3f155a5d0559ea9172421e42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cdf43d2f02bbf34a5011d8808b27d0ca8ec1f9619d7c1caefc01a9e8b68f4176bd7ff1cfe5c301ec93d9176925c9ea2033374f7753b57b629846c4c69abc2aa
|
|
7
|
+
data.tar.gz: a1db8f0d6d12bf7b68fca7144a073dfc6ad55676452bb187003c9c4dced2a6a910db9156cb86eadd2b393859a5f7a12ddc0845b783a0094e750994a24c29823c
|
data/lib/holdify/store.rb
CHANGED
|
@@ -8,7 +8,7 @@ class Holdify
|
|
|
8
8
|
class Store
|
|
9
9
|
def initialize(source_path)
|
|
10
10
|
@path = "#{source_path}#{CONFIG[:ext]}"
|
|
11
|
-
File.delete(@path) if Holdify.
|
|
11
|
+
File.delete(@path) if Holdify.reconcile && File.exist?(@path)
|
|
12
12
|
|
|
13
13
|
@source = {} # { lineno => id }
|
|
14
14
|
File.foreach(source_path).with_index(1) do |line, lineno|
|
data/lib/holdify.rb
CHANGED
|
@@ -5,11 +5,11 @@ require_relative 'holdify/store'
|
|
|
5
5
|
|
|
6
6
|
# Add description
|
|
7
7
|
class Holdify
|
|
8
|
-
VERSION = '1.0.
|
|
8
|
+
VERSION = '1.0.2'
|
|
9
9
|
CONFIG = { ext: '.yaml' }.freeze
|
|
10
10
|
|
|
11
11
|
class << self
|
|
12
|
-
attr_accessor :
|
|
12
|
+
attr_accessor :reconcile, :quiet
|
|
13
13
|
|
|
14
14
|
def stores = @stores ||= {}
|
|
15
15
|
end
|
|
@@ -32,7 +32,7 @@ class Holdify
|
|
|
32
32
|
@session[id] << actual
|
|
33
33
|
@forced << "#{location.path}:#{location.lineno}" if force
|
|
34
34
|
|
|
35
|
-
return actual if force || self.class.
|
|
35
|
+
return actual if force || self.class.reconcile
|
|
36
36
|
|
|
37
37
|
stored = @store.stored(id)
|
|
38
38
|
index = @session[id].size - 1
|
|
@@ -6,9 +6,9 @@ require 'holdify'
|
|
|
6
6
|
module Minitest
|
|
7
7
|
# Set the Holdify options
|
|
8
8
|
def self.plugin_holdify_options(opts, _options)
|
|
9
|
-
opts.on '--holdify-
|
|
10
|
-
Holdify.
|
|
11
|
-
Holdify.quiet
|
|
9
|
+
opts.on '--holdify-reconcile', 'Reconcile the held values with the new ones' do
|
|
10
|
+
Holdify.reconcile = true
|
|
11
|
+
Holdify.quiet = true
|
|
12
12
|
end
|
|
13
13
|
# :nocov:
|
|
14
14
|
opts.on '--holdify-quiet', 'Skip the warning on storing a new value' do
|
|
@@ -65,7 +65,7 @@ module Minitest
|
|
|
65
65
|
def assert_hold_?(actual, *)
|
|
66
66
|
@holdify ||= Holdify.new(self)
|
|
67
67
|
location = @holdify.find_location
|
|
68
|
-
warn "[holdify] Actual value
|
|
68
|
+
warn "[holdify] Actual value from: #{location.path}:#{location.lineno}\n=> #{actual.inspect}"
|
|
69
69
|
@holdify.hold(actual)
|
|
70
70
|
end
|
|
71
71
|
end
|
data/lib/minitest-holdify.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest-holdify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Domizio Demichelis
|
|
@@ -23,10 +23,8 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 5.0.0
|
|
26
|
-
description:
|
|
27
|
-
|
|
28
|
-
keeps it stored externally. This ensures your values hold true without polluting
|
|
29
|
-
your test files, and allows for effortless updates when your code changes.
|
|
26
|
+
description: Stop maintaining large expected values in your test/fixture files! Hold
|
|
27
|
+
them automatically. Update them effortlessly.
|
|
30
28
|
email:
|
|
31
29
|
- dd.nexus@gmail.com
|
|
32
30
|
executables: []
|
|
@@ -62,5 +60,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
60
|
requirements: []
|
|
63
61
|
rubygems_version: 3.6.9
|
|
64
62
|
specification_version: 4
|
|
65
|
-
summary: Hardcoded values suck!
|
|
63
|
+
summary: Hardcoded values suck! Holdify them.
|
|
66
64
|
test_files: []
|