rspec_approvals 0.9.3 → 0.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3ff469b7a7e1566249ed3c1c56e11121907a6a3866ad6dd5b9d754167bc8409
4
- data.tar.gz: 63aa1daaafb280caee02bac81513adfaa2a49904c0efe7c0e8413ff47d58520e
3
+ metadata.gz: 9d26b8d0d1bf05522f7e543cda72362b146b487d27c01ba9adb1e707e06e74af
4
+ data.tar.gz: 3905bc9ea0ac04b2fec29c872a4c76b413b137215afeb7cba70a78e947cfa29d
5
5
  SHA512:
6
- metadata.gz: f7acae848e872e4dce5f9a3ba712c12cec05b0fdba9103c7959c9ee9eb5989d67ee34e3ad2c1c6122d8897518eb0ef533a338466ff2e8bf9f3282b8b108b1472
7
- data.tar.gz: 4b8adb50942d8e4c4d2e5da57d8624122d9dffd72f02ad5f246d2535ca26eff3dfd827ea85f1dd35b6d30954be79eb7070ff9f3f9700cdba0f9452bf70fc46c7
6
+ metadata.gz: 746f7b8604ff122eb9c7d9da24e812942bcebba368bda1c5cccc4d551eef7fa9f719876f4b207ce770d7685426a01aaa1639c0528da380ffd4c4d46259b8d40c
7
+ data.tar.gz: 0e86027ca479594eb25bcb371436dbd6e762a9f30f1ad88ea87fd9b3c3eae9789fd24a2d754649a025e8982958ddbd9be807f6a943b9b4aed970fc42bf767341
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # RSpec Approvals
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/rspec_approvals.svg)](https://badge.fury.io/rb/rspec_approvals)
4
- [![Build Status](https://github.com/DannyBen/rspec_approvals/workflows/Test/badge.svg)](https://github.com/DannyBen/rspec_approvals/actions?query=workflow%3ATest)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/b6ca26de93d9236c706a/maintainability)](https://codeclimate.com/github/DannyBen/rspec_approvals/maintainability)
6
-
7
- ---
3
+ ![repocard](https://repocard.dannyben.com/svg/rspec_approvals.svg)
8
4
 
9
5
  RSpec Approvals allows you to interactively review and approve testable
10
6
  content.
@@ -9,9 +9,9 @@ require 'stringio'
9
9
  unless StringIO.method_defined? :ioctl
10
10
  class StringIO
11
11
  def ioctl(*)
12
- # :nocov:
12
+ # simplecov:disable
13
13
  80
14
- # :nocov:
14
+ # simplecov:enable
15
15
  end
16
16
  end
17
17
  end
@@ -19,9 +19,9 @@ end
19
19
  unless StringIO.method_defined? :wait_readable
20
20
  class StringIO
21
21
  def wait_readable(*)
22
- # :nocov:
22
+ # simplecov:disable
23
23
  true
24
- # :nocov:
24
+ # simplecov:enable
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,32 @@
1
+ module RSpecApprovals
2
+ module Levenshtein
3
+ def self.distance(a, b)
4
+ return 0 if a == b
5
+
6
+ # Use the shorter string for the columns of the two working rows.
7
+ a, b = b, a if a.length < b.length
8
+ return a.length if b.empty?
9
+
10
+ previous = (0..b.length).to_a
11
+ chars = b.chars
12
+
13
+ a.each_char.with_index(1) do |char, i|
14
+ current = [i]
15
+
16
+ chars.each_with_index do |other, j|
17
+ cost = char == other ? 0 : 1
18
+
19
+ current << [
20
+ previous[j + 1] + 1,
21
+ current[j] + 1,
22
+ previous[j] + cost,
23
+ ].min
24
+ end
25
+
26
+ previous = current
27
+ end
28
+
29
+ previous.last
30
+ end
31
+ end
32
+ end
@@ -73,7 +73,7 @@ module RSpecApprovals
73
73
  end
74
74
 
75
75
  # Returns true if RSpec is configured to sanitize (remove ANSI escape
76
- # codes) from the actual strings before proceeeding to comparing them.
76
+ # codes) from the actual strings before proceeding to comparing them.
77
77
  def sanitize?
78
78
  RSpec.configuration.strip_ansi_escape
79
79
  end
@@ -110,9 +110,9 @@ module RSpecApprovals
110
110
  end
111
111
 
112
112
  # Do the actual test.
113
- # - If .before() was used, we foreward the actual output to the
113
+ # - If .before() was used, we forward the actual output to the
114
114
  # proc for processing first.
115
- # - If before_approval proc was configured, forward the acual output
115
+ # - If before_approval proc was configured, forward the actual output
116
116
  # to the proc for processing.
117
117
  # - If .diff() was used, then distance will be set and then
118
118
  # we "levenshtein it".
@@ -129,7 +129,7 @@ module RSpecApprovals
129
129
  end
130
130
 
131
131
  if distance
132
- @actual_distance = String::Similarity.levenshtein_distance expected, actual
132
+ @actual_distance = Levenshtein.distance expected, actual
133
133
  @actual_distance <= distance
134
134
  else
135
135
  actual == expected
@@ -1,5 +1,3 @@
1
- require 'string-similarity'
2
-
3
1
  module RSpecApprovals
4
2
  module Matchers
5
3
  # Adds the matcher to RSpec:
@@ -1,3 +1,3 @@
1
1
  module RSpecApprovals
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
@@ -5,6 +5,7 @@ require 'rspec_approvals/module_functions'
5
5
  require 'rspec_approvals/prompt'
6
6
  require 'rspec_approvals/stream'
7
7
  require 'rspec_approvals/approval_handler'
8
+ require 'rspec_approvals/levenshtein'
8
9
  require 'rspec_approvals/matchers/base'
9
10
  require 'rspec_approvals/matchers/match_approval'
10
11
  require 'rspec_approvals/matchers/output_approval'
metadata CHANGED
@@ -1,35 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_approvals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: colsole
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.8.1
20
- - - "<"
16
+ - - "~>"
21
17
  - !ruby/object:Gem::Version
22
- version: '2'
18
+ version: '1.0'
23
19
  type: :runtime
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 0.8.1
30
- - - "<"
23
+ - - "~>"
31
24
  - !ruby/object:Gem::Version
32
- version: '2'
25
+ version: '1.0'
33
26
  - !ruby/object:Gem::Dependency
34
27
  name: diffy
35
28
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +51,6 @@ dependencies:
58
51
  - - "~>"
59
52
  - !ruby/object:Gem::Version
60
53
  version: '0.2'
61
- - !ruby/object:Gem::Dependency
62
- name: string-similarity
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '2.1'
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '2.1'
75
54
  description: Automatic interactive approvals for rspec
76
55
  email: db@dannyben.com
77
56
  executables: []
@@ -83,6 +62,7 @@ files:
83
62
  - lib/rspec_approvals/approval_handler.rb
84
63
  - lib/rspec_approvals/extensions/file.rb
85
64
  - lib/rspec_approvals/extensions/stringio.rb
65
+ - lib/rspec_approvals/levenshtein.rb
86
66
  - lib/rspec_approvals/matchers/base.rb
87
67
  - lib/rspec_approvals/matchers/match_approval.rb
88
68
  - lib/rspec_approvals/matchers/output_approval.rb
@@ -96,8 +76,10 @@ homepage: https://github.com/DannyBen/rspec_approvals
96
76
  licenses:
97
77
  - MIT
98
78
  metadata:
79
+ bug_tracker_uri: https://github.com/dannyben/rspec_approvals/issues
80
+ changelog_uri: https://github.com/dannyben/rspec_approvals/blob/master/CHANGELOG.md
81
+ source_code_uri: https://github.com/dannyben/rspec_approvals
99
82
  rubygems_mfa_required: 'true'
100
- post_install_message:
101
83
  rdoc_options: []
102
84
  require_paths:
103
85
  - lib
@@ -105,15 +87,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
87
  requirements:
106
88
  - - ">="
107
89
  - !ruby/object:Gem::Version
108
- version: 2.6.0
90
+ version: '3.3'
109
91
  required_rubygems_version: !ruby/object:Gem::Requirement
110
92
  requirements:
111
93
  - - ">="
112
94
  - !ruby/object:Gem::Version
113
95
  version: '0'
114
96
  requirements: []
115
- rubygems_version: 3.4.5
116
- signing_key:
97
+ rubygems_version: 4.0.19
117
98
  specification_version: 4
118
99
  summary: Interactive RSpec Approvals
119
100
  test_files: []