approvals 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +1 -1
- data/lib/approvals/approval.rb +4 -4
- data/lib/approvals/dotfile.rb +1 -1
- data/lib/approvals/filter.rb +1 -1
- data/lib/approvals/namers/directory_namer.rb +3 -7
- data/lib/approvals/namers/rspec_namer.rb +8 -3
- data/lib/approvals/version.rb +1 -1
- data/lib/approvals/writers/binary_writer.rb +4 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83fdc1b67aa0b4262df63630332d038a42c04de8
|
4
|
+
data.tar.gz: ade116ca8534915b28e6d052a3f8d215c915cdb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76a9cf43067226a8a74178c4b5b762d9c6132ac781b4680324023e9a35c39c2383c6fc7a8b9341fd144704b718ef1282c00ff2addf673699a3f1d31d299a5d9
|
7
|
+
data.tar.gz: 23b5b8ce78c15b97a4665eb6daaaca00eccba0ae5e9841743d5bf9483ce5bad5d017e8e76a95bf376414929a4dad60832990fe22baa6975c171df5d065ba718a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/approvals/approval.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'erb' # It is referenced on line
|
1
|
+
require 'erb' # It is referenced on line 69
|
2
2
|
module Approvals
|
3
3
|
class Approval
|
4
4
|
class << self
|
@@ -35,7 +35,7 @@ module Approvals
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def verify
|
38
|
-
unless File.
|
38
|
+
unless File.exist?(namer.output_dir)
|
39
39
|
FileUtils.mkdir_p(namer.output_dir)
|
40
40
|
end
|
41
41
|
|
@@ -57,11 +57,11 @@ module Approvals
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def approved?
|
60
|
-
File.
|
60
|
+
File.exist? approved_path
|
61
61
|
end
|
62
62
|
|
63
63
|
BINARY_FORMATS = [:binary]
|
64
|
-
|
64
|
+
|
65
65
|
def received_matches?
|
66
66
|
if BINARY_FORMATS.include?(@format) # Read without ERB
|
67
67
|
IO.read(received_path).chomp == IO.read(approved_path).chomp
|
data/lib/approvals/dotfile.rb
CHANGED
data/lib/approvals/filter.rb
CHANGED
@@ -20,7 +20,7 @@ module Approvals
|
|
20
20
|
when Array
|
21
21
|
value.map { |item| censored(item) }
|
22
22
|
when Hash
|
23
|
-
Hash[value.map { |
|
23
|
+
Hash[value.map { |inner_key, inner_value| [inner_key, censored(inner_value, inner_key)] }]
|
24
24
|
else
|
25
25
|
if value.nil?
|
26
26
|
nil
|
@@ -1,17 +1,13 @@
|
|
1
1
|
module Approvals
|
2
2
|
module Namers
|
3
3
|
class DirectoryNamer < RSpecNamer
|
4
|
+
private
|
4
5
|
|
5
|
-
def
|
6
|
-
|
6
|
+
def name_for_example(example)
|
7
|
+
directorize example
|
7
8
|
end
|
8
9
|
|
9
|
-
private
|
10
|
-
|
11
10
|
def directorize(example)
|
12
|
-
parts = [ ]
|
13
|
-
metadata = example.metadata
|
14
|
-
|
15
11
|
approvals_path = lambda do |metadata|
|
16
12
|
description = normalize metadata[:description]
|
17
13
|
example_group = if metadata.key?(:example_group)
|
@@ -1,10 +1,15 @@
|
|
1
1
|
module Approvals
|
2
2
|
module Namers
|
3
3
|
class RSpecNamer
|
4
|
-
|
5
4
|
attr_reader :name
|
5
|
+
|
6
6
|
def initialize(example)
|
7
|
-
@name =
|
7
|
+
@name = name_for_example(example)
|
8
|
+
@output_dir = nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def name_for_example(example)
|
12
|
+
normalize example.full_description
|
8
13
|
end
|
9
14
|
|
10
15
|
def normalize(string)
|
@@ -15,7 +20,7 @@ module Approvals
|
|
15
20
|
unless @output_dir
|
16
21
|
begin
|
17
22
|
@output_dir = ::RSpec.configuration.approvals_path
|
18
|
-
rescue NoMethodError
|
23
|
+
rescue NoMethodError
|
19
24
|
end
|
20
25
|
@output_dir ||= 'spec/fixtures/approvals/'
|
21
26
|
end
|
data/lib/approvals/version.rb
CHANGED
@@ -6,19 +6,13 @@ module Approvals
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def initialize(opts = {})
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
@autoregister = opts[:autoregister] || true
|
10
|
+
@detect = opts[:detect]
|
11
|
+
@extension = opts[:extension] || ''
|
12
|
+
@write = opts[:write] || EXCEPTION_WRITER
|
13
13
|
self.format = opts[:format] || :binary
|
14
14
|
end
|
15
15
|
|
16
|
-
attr_accessor :autoregister
|
17
|
-
attr_accessor :extension
|
18
|
-
attr_accessor :write
|
19
|
-
attr_accessor :detect
|
20
|
-
|
21
|
-
|
22
16
|
attr_reader :format
|
23
17
|
|
24
18
|
def format=(sym)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|