approvals 0.0.22 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +4 -0
- data/.travis.yml +21 -4
- data/CHANGELOG.md +2 -0
- data/README.md +54 -21
- data/approvals.gemspec +14 -5
- data/lib/approvals/approval.rb +10 -2
- data/lib/approvals/filter.rb +11 -11
- data/lib/approvals/verifier.rb +15 -0
- data/lib/approvals/verifiers/json_verifier.rb +26 -0
- data/lib/approvals/version.rb +1 -1
- data/lib/approvals/writer.rb +10 -4
- data/lib/approvals.rb +1 -0
- data/spec/approvals_spec.rb +32 -0
- data/spec/filter_spec.rb +34 -0
- data/spec/fixtures/approvals/approvals_custom_writer_verifies_a_complex_object.approved.txt +1 -0
- data/spec/fixtures/approvals/approvals_ignores_whitespace_differences_in_json.approved.json +6 -0
- data/spec/fixtures/approvals/approvals_verifies_json_with_a_time_object.approved.json +3 -0
- data/spec/fixtures/json_approval_with_different_whitespace/approved.json +7 -0
- data/spec/fixtures/json_approval_with_different_whitespace/received.json +3 -0
- data/spec/fixtures/json_approval_with_different_whitespace/received_different_content.json +3 -0
- data/spec/verifiers/json_verifier_spec.rb +33 -0
- metadata +41 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cc889240c80c9fb3649ef9b9edfd7b7fa54d2921d678dfe4303c3821ee2a23c8
|
4
|
+
data.tar.gz: 30c4924a8e599a89c9c386892719ebfa9bdc3c6cc0664be606de4dc83c23c217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb1489bae6337b513eac1e1cd78a789612357bd43d35bd874b324ee03c4ae8314e5fbf5377853cbe60effea3b2e87b85a1028bb3c62910dab13e1aae912f3a9
|
7
|
+
data.tar.gz: 99756cc25f1c2f3492de6291280b3483d861fe4977d11c19a5eee9c0372541457b05a7704c9fe6eabc909c0bcb6817c89ddf13bc89d0b6b009a0b27607abd2f9
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.2
|
4
|
-
- 1.9.3
|
5
3
|
- 2.0.0
|
6
|
-
- 2.1.
|
4
|
+
- 2.1.10
|
5
|
+
- 2.2.10
|
6
|
+
- 2.3.8
|
7
|
+
- 2.4.8
|
8
|
+
- 2.5.7
|
9
|
+
- 2.6.5
|
10
|
+
- 2.7.0
|
7
11
|
- ruby-head
|
8
|
-
- rbx-
|
12
|
+
- rbx-3
|
13
|
+
matrix:
|
14
|
+
allow_failures:
|
15
|
+
- rvm: rbx-3
|
16
|
+
before_install:
|
17
|
+
- |
|
18
|
+
r_eng="$(ruby -e 'STDOUT.write RUBY_ENGINE')";
|
19
|
+
rv="$(ruby -e 'STDOUT.write RUBY_VERSION')";
|
20
|
+
if [ "$r_eng" == "ruby" ]; then
|
21
|
+
if [ "$rv" \< "2.3" ]; then gem update --system 2.7.10 --no-document
|
22
|
+
elif [ "$rv" \< "2.6" ]; then gem update --system --no-document --conservative
|
23
|
+
fi
|
24
|
+
fi
|
25
|
+
- gem update bundler
|
9
26
|
script: bundle exec rspec spec
|
10
27
|
cache: bundler
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -23,8 +23,8 @@ which Llewellyn Falco is interviewed about approvals.
|
|
23
23
|
## Configuration
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
Approvals.configure do |
|
27
|
-
|
26
|
+
Approvals.configure do |config|
|
27
|
+
config.approvals_path = 'output/goes/here/'
|
28
28
|
end
|
29
29
|
```
|
30
30
|
|
@@ -42,18 +42,43 @@ Approvals.verify(your_subject, :format => :json)
|
|
42
42
|
|
43
43
|
This will raise an `ApprovalError` in the case of a failure.
|
44
44
|
|
45
|
-
The default writer uses the `:to_s` method on the subject will be used to generate the output for
|
46
|
-
the `received` file. For custom complex objects you will need to override
|
47
|
-
`:to_s` to get helpful output, rather than the default:
|
48
|
-
|
49
|
-
#<Object:0x0000010105ea40> # or whatever the object id is
|
50
|
-
|
51
45
|
The first time the approval is run, a file will be created with the contents of the subject of your approval:
|
52
46
|
|
53
47
|
the_name_of_the_approval.received.txt # or .json, .html, .xml as appropriate
|
54
48
|
|
55
49
|
Since you have not yet approved anything, the `*.approved` file does not exist, and the comparison will fail.
|
56
50
|
|
51
|
+
### Customizing formatted output
|
52
|
+
|
53
|
+
The default writer uses the `:to_s` method on the subject to generate the output for the received file.
|
54
|
+
For custom complex objects you will need to provide a custom writer to get helpful output, rather than the default:
|
55
|
+
|
56
|
+
#<Object:0x0000010105ea40> # or whatever the object id is
|
57
|
+
|
58
|
+
Create a custom writer class somewhere accessible to your test:
|
59
|
+
|
60
|
+
```
|
61
|
+
class MyCustomWriter < Approvals::Writers::TextWriter
|
62
|
+
def format(data)
|
63
|
+
# Custom data formatting here
|
64
|
+
end
|
65
|
+
|
66
|
+
def filter(data)
|
67
|
+
# Custom data filtering here
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
In your test, use a string to reference your custom class:
|
73
|
+
|
74
|
+
```
|
75
|
+
it "verifies a complex object" do
|
76
|
+
Approvals.verify hello, :format => "MyCustomWriter"
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
Define and use different custom writers as needed!
|
81
|
+
|
57
82
|
## CLI
|
58
83
|
|
59
84
|
The gem comes with a command-line tool that makes it easier to manage the
|
@@ -115,17 +140,17 @@ spec/fixtures/approvals/
|
|
115
140
|
You can override this:
|
116
141
|
|
117
142
|
```ruby
|
118
|
-
RSpec.configure do |
|
119
|
-
|
143
|
+
RSpec.configure do |config|
|
144
|
+
config.approvals_path = 'some/other/path'
|
120
145
|
end
|
121
146
|
```
|
122
147
|
|
123
148
|
The basic format of the approval is modeled after RSpec's `it`:
|
124
149
|
|
125
150
|
```ruby
|
126
|
-
it
|
151
|
+
it 'works' do
|
127
152
|
verify do
|
128
|
-
|
153
|
+
'this is the the thing you want to verify'
|
129
154
|
end
|
130
155
|
end
|
131
156
|
```
|
@@ -135,21 +160,21 @@ end
|
|
135
160
|
When using RSpec, the namer is set for you, using the example's `full_description`.
|
136
161
|
|
137
162
|
```ruby
|
138
|
-
Approvals.verify(thing, :name =>
|
163
|
+
Approvals.verify(thing, :name => 'the name of your test')
|
139
164
|
```
|
140
165
|
|
141
166
|
### Formatting
|
142
167
|
|
143
168
|
You can pass a format for your output before it gets written to the file.
|
144
|
-
At the moment, only text, xml, html, and json are supported.
|
169
|
+
At the moment, only text, xml, html, and json are supported, while text is the default.
|
145
170
|
|
146
|
-
Simply add a `:format => :
|
171
|
+
Simply add a `:format => :txt`, `:format => :xml`, `:format => :html`, or `:format => :json` option to the example:
|
147
172
|
|
148
173
|
```ruby
|
149
|
-
page =
|
174
|
+
page = '<html><head></head><body><h1>ZOMG</h1></body></html>'
|
150
175
|
Approvals.verify page, :format => :html
|
151
176
|
|
152
|
-
data =
|
177
|
+
data = '{\'beverage\':\'coffee\'}'
|
153
178
|
Approvals.verify data, :format => :json
|
154
179
|
```
|
155
180
|
|
@@ -157,19 +182,27 @@ In RSpec, it looks like this:
|
|
157
182
|
|
158
183
|
```ruby
|
159
184
|
verify :format => :html do
|
160
|
-
|
185
|
+
'<html><head></head><body><h1>ZOMG</h1></body></html>'
|
161
186
|
end
|
162
187
|
|
163
188
|
verify :format => :json do
|
164
|
-
|
189
|
+
'{\'beverage\':\'coffee\'}'
|
190
|
+
end
|
191
|
+
```
|
192
|
+
|
193
|
+
If you like you could also change the default format globally with:
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
RSpec.configure do |config|
|
197
|
+
config.approvals_default_format = :json # or :xml, :html
|
165
198
|
end
|
166
199
|
```
|
167
200
|
|
168
201
|
### Exclude dynamically changed values from json
|
169
202
|
|
170
203
|
```ruby
|
171
|
-
Approvals.configure do |
|
172
|
-
|
204
|
+
Approvals.configure do |config|
|
205
|
+
config.excluded_json_keys = {
|
173
206
|
:id =>/(\A|_)id$/,
|
174
207
|
:date => /_at$/
|
175
208
|
}
|
data/approvals.gemspec
CHANGED
@@ -9,9 +9,9 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.licenses = ['MIT']
|
10
10
|
s.authors = ["Katrina Owen"]
|
11
11
|
s.email = ["katrina.owen@gmail.com"]
|
12
|
-
s.homepage = ""
|
12
|
+
s.homepage = "https://github.com/kytrinyx/approvals"
|
13
13
|
s.summary = %q{Approval Tests for Ruby}
|
14
|
-
s.description = %q{
|
14
|
+
s.description = %q{A library to make it easier to do golden-master style testing in Ruby}
|
15
15
|
|
16
16
|
s.rubyforge_project = "approvals"
|
17
17
|
|
@@ -20,8 +20,17 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
+
s.add_dependency 'thor', '~> 1.0'
|
24
|
+
s.add_dependency 'json', '~> 2.0'
|
25
|
+
|
26
|
+
if RUBY_VERSION < "2.1"
|
27
|
+
s.add_dependency 'nokogiri', '~> 1.6.8'
|
28
|
+
else
|
29
|
+
s.add_dependency 'nokogiri', '~> 1.8'
|
30
|
+
end
|
31
|
+
# We also depend on the json gem, but the version we need is
|
32
|
+
# Ruby-version-specific. See `ext/mkrf_conf.rb`.
|
33
|
+
|
34
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
23
35
|
s.add_development_dependency 'rspec', '~> 3.1'
|
24
|
-
s.add_development_dependency 'json', '~> 1.8'
|
25
|
-
s.add_dependency 'thor', '~> 0.18'
|
26
|
-
s.add_dependency 'nokogiri', '~> 1.6'
|
27
36
|
end
|
data/lib/approvals/approval.rb
CHANGED
@@ -19,9 +19,9 @@ module Approvals
|
|
19
19
|
# Add a Proc that tests if subject is a kind of format
|
20
20
|
IDENTITIES = {
|
21
21
|
hash: Proc.new(){|subject|subject.respond_to? :each_pair},
|
22
|
-
array: Proc.new(){|subject|subject.respond_to? :each_with_index},
|
22
|
+
array: Proc.new(){|subject|subject.respond_to? :each_with_index},
|
23
23
|
}
|
24
|
-
|
24
|
+
|
25
25
|
def identify_format
|
26
26
|
IDENTITIES.each_pair do |format, id_test|
|
27
27
|
return format if id_test.call(subject)
|
@@ -34,6 +34,10 @@ module Approvals
|
|
34
34
|
@writer ||= Writer.for(@format)
|
35
35
|
end
|
36
36
|
|
37
|
+
def verifier
|
38
|
+
@verifier ||= Verifier.for(@format)
|
39
|
+
end
|
40
|
+
|
37
41
|
def verify
|
38
42
|
unless File.exist?(namer.output_dir)
|
39
43
|
FileUtils.mkdir_p(namer.output_dir)
|
@@ -63,6 +67,10 @@ module Approvals
|
|
63
67
|
BINARY_FORMATS = [:binary]
|
64
68
|
|
65
69
|
def received_matches?
|
70
|
+
return verifier
|
71
|
+
.new(received_path, approved_path)
|
72
|
+
.verify if verifier
|
73
|
+
|
66
74
|
if BINARY_FORMATS.include?(@format) # Read without ERB
|
67
75
|
IO.read(received_path).chomp == IO.read(approved_path).chomp
|
68
76
|
else
|
data/lib/approvals/filter.rb
CHANGED
@@ -16,18 +16,18 @@ module Approvals
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def censored value, key=nil
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Hash[value.map { |inner_key, inner_value| [inner_key, censored(inner_value, inner_key)] }]
|
19
|
+
if value.nil?
|
20
|
+
nil
|
21
|
+
elsif key && placeholder_for(key)
|
22
|
+
"<#{placeholder_for(key)}>"
|
24
23
|
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
case value
|
25
|
+
when Array
|
26
|
+
value.map { |item| censored(item) }
|
27
|
+
when Hash
|
28
|
+
Hash[value.map { |inner_key, inner_value| [inner_key, censored(inner_value, inner_key)] }]
|
29
|
+
else
|
30
|
+
value
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Approvals
|
2
|
+
module Verifiers
|
3
|
+
class JsonVerifier
|
4
|
+
def initialize(received_path, approved_path)
|
5
|
+
self.received_path = received_path
|
6
|
+
self.approved_path = approved_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def verify
|
10
|
+
approved == received
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_accessor :approved_path, :received_path
|
16
|
+
|
17
|
+
def approved
|
18
|
+
JSON.parse(File.read(approved_path))
|
19
|
+
end
|
20
|
+
|
21
|
+
def received
|
22
|
+
JSON.parse(File.read(received_path))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/approvals/version.rb
CHANGED
data/lib/approvals/writer.rb
CHANGED
@@ -16,15 +16,21 @@ module Approvals
|
|
16
16
|
html: Writers::HtmlWriter.new,
|
17
17
|
hash: Writers::HashWriter.new,
|
18
18
|
array: Writers::ArrayWriter.new,
|
19
|
+
txt: Writers::TextWriter.new,
|
19
20
|
}
|
20
21
|
|
21
22
|
|
22
23
|
class << self
|
23
24
|
def for(format)
|
24
|
-
|
25
|
-
REGISTRY[format]
|
26
|
-
|
27
|
-
|
25
|
+
begin
|
26
|
+
REGISTRY[format] || Object.const_get(format).new
|
27
|
+
rescue NameError => e
|
28
|
+
error = ApprovalError.new(
|
29
|
+
"Approval Error: #{ e }. Please define a custom writer as outlined"\
|
30
|
+
" in README section 'Customizing formatted output': "\
|
31
|
+
"https://github.com/kytrinyx/approvals#customizing-formatted-output"
|
32
|
+
)
|
33
|
+
raise error
|
28
34
|
end
|
29
35
|
end
|
30
36
|
end
|
data/lib/approvals.rb
CHANGED
data/spec/approvals_spec.rb
CHANGED
@@ -51,6 +51,32 @@ describe Approvals do
|
|
51
51
|
Approvals.verify hello, :namer => namer
|
52
52
|
end
|
53
53
|
|
54
|
+
context "custom writer" do
|
55
|
+
let(:hello) { Object.new }
|
56
|
+
|
57
|
+
class MyCustomWriter < Approvals::Writers::TextWriter
|
58
|
+
def format(data)
|
59
|
+
filter(data)
|
60
|
+
end
|
61
|
+
|
62
|
+
def filter(data)
|
63
|
+
data.to_s.chars.reject {|c| c =~ /[a-zA-Z0-9]/}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "verifies a complex object" do
|
68
|
+
Approvals.verify hello, :namer => namer, :format => "MyCustomWriter"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "raises an error with an uninitialized custom writer class" do
|
72
|
+
expect{
|
73
|
+
Approvals.verify hello, :namer => namer, :format => "UninitializedWriter"
|
74
|
+
}.to raise_error.with_message(
|
75
|
+
/Please define a custom writer as outlined in README section 'Customizing formatted output':/
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
54
80
|
it "verifies html" do
|
55
81
|
html = <<-HTML
|
56
82
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"><html><head><title>Approval</title></head><body><h1>An Approval</h1><p>It has a paragraph</p></body></html>
|
@@ -59,6 +85,7 @@ describe Approvals do
|
|
59
85
|
end
|
60
86
|
|
61
87
|
it "verifies a malformed html fragment" do
|
88
|
+
pending
|
62
89
|
html = <<-HTML
|
63
90
|
<!DOCTYPE html>
|
64
91
|
<html>
|
@@ -79,6 +106,11 @@ describe Approvals do
|
|
79
106
|
Approvals.verify json, :format => :json, :namer => namer
|
80
107
|
end
|
81
108
|
|
109
|
+
it "ignores whitespace differences in json" do
|
110
|
+
hash = { foo: {} }
|
111
|
+
|
112
|
+
Approvals.verify hash, :format => :json, :namer => namer
|
113
|
+
end
|
82
114
|
|
83
115
|
it "verifies json and is newline agnostic" do
|
84
116
|
json = '{"pet":{"species":"turtle","color":"green","name":"Anthony"}}'
|
data/spec/filter_spec.rb
CHANGED
@@ -74,6 +74,40 @@ describe Approvals::Filter do
|
|
74
74
|
})
|
75
75
|
end
|
76
76
|
|
77
|
+
it "filters array keys" do
|
78
|
+
filter = Approvals::Filter.new({foolist: /^foolist$/})
|
79
|
+
input = {
|
80
|
+
foo: 'bar124',
|
81
|
+
foolist: [{foo: 'bar 145', bar: 'foo'}, 'foobar'],
|
82
|
+
nonfoo: 'bar',
|
83
|
+
}
|
84
|
+
|
85
|
+
output = filter.apply(input)
|
86
|
+
|
87
|
+
expect(output).to eq({
|
88
|
+
foo: 'bar124',
|
89
|
+
foolist: '<foolist>',
|
90
|
+
nonfoo: 'bar',
|
91
|
+
})
|
92
|
+
end
|
93
|
+
|
94
|
+
it "filters hash keys" do
|
95
|
+
filter = Approvals::Filter.new({foohash: /^foohash$/})
|
96
|
+
input = {
|
97
|
+
foo: 'bar124',
|
98
|
+
foohash: {foo: 'bar 145', barlist: ['foo', 'bar']},
|
99
|
+
nonfoo: 'bar',
|
100
|
+
}
|
101
|
+
|
102
|
+
output = filter.apply(input)
|
103
|
+
|
104
|
+
expect(output).to eq({
|
105
|
+
foo: 'bar124',
|
106
|
+
foohash: '<foohash>',
|
107
|
+
nonfoo: 'bar',
|
108
|
+
})
|
109
|
+
end
|
110
|
+
|
77
111
|
it "takes the last applicable filter" do
|
78
112
|
filter = Approvals::Filter.new({foo: /^foo/, bar: /bar$/})
|
79
113
|
input = {
|
@@ -0,0 +1 @@
|
|
1
|
+
["#", "<", ":", ">"]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Approvals::Verifiers::JsonVerifier do
|
4
|
+
subject(:instance) do
|
5
|
+
described_class.new(received_path, approved_path)
|
6
|
+
end
|
7
|
+
|
8
|
+
context "with same json content but different formatting" do
|
9
|
+
let(:received_path) do
|
10
|
+
"./spec/fixtures/json_approval_with_different_whitespace/received.json"
|
11
|
+
end
|
12
|
+
let(:approved_path) do
|
13
|
+
"./spec/fixtures/json_approval_with_different_whitespace/approved.json"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "passes verification" do
|
17
|
+
expect(instance.verify).to be_truthy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with different json content" do
|
22
|
+
let(:received_path) do
|
23
|
+
"./spec/fixtures/json_approval_with_different_whitespace/received_different_content.json"
|
24
|
+
end
|
25
|
+
let(:approved_path) do
|
26
|
+
"./spec/fixtures/json_approval_with_different_whitespace/approved.json"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "does not passe verification" do
|
30
|
+
expect(instance.verify).to be_falsy
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,37 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: approvals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '1.8'
|
34
|
-
type: :
|
48
|
+
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
@@ -39,34 +53,34 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '1.8'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
48
|
-
type: :
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
68
|
+
version: '13.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
62
|
-
type: :
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1
|
69
|
-
description:
|
82
|
+
version: '3.1'
|
83
|
+
description: A library to make it easier to do golden-master style testing in Ruby
|
70
84
|
email:
|
71
85
|
- katrina.owen@gmail.com
|
72
86
|
executables:
|
@@ -112,6 +126,8 @@ files:
|
|
112
126
|
- lib/approvals/rspec.rb
|
113
127
|
- lib/approvals/scrubber.rb
|
114
128
|
- lib/approvals/system_command.rb
|
129
|
+
- lib/approvals/verifier.rb
|
130
|
+
- lib/approvals/verifiers/json_verifier.rb
|
115
131
|
- lib/approvals/version.rb
|
116
132
|
- lib/approvals/writer.rb
|
117
133
|
- lib/approvals/writers/array_writer.rb
|
@@ -127,6 +143,8 @@ files:
|
|
127
143
|
- spec/executable_spec.rb
|
128
144
|
- spec/extensions/rspec_approvals_spec.rb
|
129
145
|
- spec/filter_spec.rb
|
146
|
+
- spec/fixtures/approvals/approvals_custom_writer_verifies_a_complex_object.approved.txt
|
147
|
+
- spec/fixtures/approvals/approvals_ignores_whitespace_differences_in_json.approved.json
|
130
148
|
- spec/fixtures/approvals/approvals_passes_approved_files_through_erb.approved.txt
|
131
149
|
- spec/fixtures/approvals/approvals_passes_the_received_files_through_erb.approved.txt
|
132
150
|
- spec/fixtures/approvals/approvals_supports_excluded_keys_option_also_supports_an_array_of_hashes.approved.json
|
@@ -143,6 +161,7 @@ files:
|
|
143
161
|
- spec/fixtures/approvals/approvals_verifies_html.approved.html
|
144
162
|
- spec/fixtures/approvals/approvals_verifies_json.approved.json
|
145
163
|
- spec/fixtures/approvals/approvals_verifies_json_and_is_newline_agnostic.approved.json
|
164
|
+
- spec/fixtures/approvals/approvals_verifies_json_with_a_time_object.approved.json
|
146
165
|
- spec/fixtures/approvals/approvals_verifies_xml.approved.xml
|
147
166
|
- spec/fixtures/approvals/verifications_a_string.approved.txt
|
148
167
|
- spec/fixtures/approvals/verifies_a_complex_object.approved.txt
|
@@ -163,6 +182,9 @@ files:
|
|
163
182
|
- spec/fixtures/approvals/verifies_html.approved.html
|
164
183
|
- spec/fixtures/approvals/verifies_json.approved.json
|
165
184
|
- spec/fixtures/approvals/verifies_xml.approved.xml
|
185
|
+
- spec/fixtures/json_approval_with_different_whitespace/approved.json
|
186
|
+
- spec/fixtures/json_approval_with_different_whitespace/received.json
|
187
|
+
- spec/fixtures/json_approval_with_different_whitespace/received_different_content.json
|
166
188
|
- spec/fixtures/one.png
|
167
189
|
- spec/fixtures/one.txt
|
168
190
|
- spec/fixtures/two.png
|
@@ -180,7 +202,8 @@ files:
|
|
180
202
|
- spec/scrubber_spec.rb
|
181
203
|
- spec/spec_helper.rb
|
182
204
|
- spec/system_command_spec.rb
|
183
|
-
|
205
|
+
- spec/verifiers/json_verifier_spec.rb
|
206
|
+
homepage: https://github.com/kytrinyx/approvals
|
184
207
|
licenses:
|
185
208
|
- MIT
|
186
209
|
metadata: {}
|
@@ -199,10 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
222
|
- !ruby/object:Gem::Version
|
200
223
|
version: '0'
|
201
224
|
requirements: []
|
202
|
-
|
203
|
-
rubygems_version: 2.2.2
|
225
|
+
rubygems_version: 3.1.6
|
204
226
|
signing_key:
|
205
227
|
specification_version: 4
|
206
228
|
summary: Approval Tests for Ruby
|
207
229
|
test_files: []
|
208
|
-
has_rdoc:
|