rspec-snapshot 0.1.1 → 0.1.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 +5 -5
- data/lib/rspec/snapshot/matchers/match_snapshot.rb +8 -3
- data/lib/rspec/snapshot/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5ad0d5d187025c941d709184e5dc59c3bc0c4a3b8930e968da9542c73a554b51
|
4
|
+
data.tar.gz: 2c7b8ea85fee0876131d0fa8fa2f9daaf1be595befd9dd5a362f879d385f6ad1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05567f1f4c658a9d065c73634fcd73944f4263ac3616fe220db65e527f1b318ab5ecd3e7fde35fbc5234cde50c9f842541653b94fecf33baedcfb43a95c3ccb0
|
7
|
+
data.tar.gz: 18a7088b304ee61b2fc8d1a2bb8d63ebbd2cf29949c63f30dbb226461a35d3ddfd104104e586bf1e4b2e00252362ce45ca73d4f42d05f380b3767bcb70862663
|
@@ -4,6 +4,8 @@ module RSpec
|
|
4
4
|
module Snapshot
|
5
5
|
module Matchers
|
6
6
|
class MatchSnapShot
|
7
|
+
attr_reader :actual, :expected
|
8
|
+
|
7
9
|
def initialize(metadata, snapshot_name)
|
8
10
|
@metadata = metadata
|
9
11
|
@snapshot_name = snapshot_name
|
@@ -16,9 +18,9 @@ module RSpec
|
|
16
18
|
FileUtils.mkdir_p(File.dirname(snap_path)) unless Dir.exist?(File.dirname(snap_path))
|
17
19
|
if File.exist?(snap_path)
|
18
20
|
file = File.new(snap_path)
|
19
|
-
@
|
21
|
+
@expected = file.read
|
20
22
|
file.close
|
21
|
-
@actual == @
|
23
|
+
@actual.to_s == @expected
|
22
24
|
else
|
23
25
|
RSpec.configuration.reporter.message "Generate #{snap_path}"
|
24
26
|
file = File.new(snap_path, "w+")
|
@@ -28,9 +30,12 @@ module RSpec
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
33
|
+
def diffable?
|
34
|
+
true
|
35
|
+
end
|
31
36
|
|
32
37
|
def failure_message
|
33
|
-
"\nexpected: #{@
|
38
|
+
"\nexpected: #{@expected}\n got: #{@actual}\n"
|
34
39
|
end
|
35
40
|
|
36
41
|
def snapshot_dir
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wei Zhu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -119,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
|
123
|
-
rubygems_version: 2.6.8
|
122
|
+
rubygems_version: 3.0.3
|
124
123
|
signing_key:
|
125
124
|
specification_version: 4
|
126
125
|
summary: RSpec Snapshot Matcher
|