snapshot_testing 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a09c878dab9b37cfb19478f2647d404fc1091840
4
- data.tar.gz: 83d05b1d4a199a08f44e0c4a3d5a01b3e07f9754
3
+ metadata.gz: 34fda2f98525f2de25ae45b78c943965afae17b2
4
+ data.tar.gz: 488bab370972b35f7b891b11012abdcd1b68bb23
5
5
  SHA512:
6
- metadata.gz: 3d630db5ee68d5dcb9df88b29f6991eacbdee0f150c03282f6e6121eb434bf9476985111e71438e5b8ae8d66af1c29d12d50078f6fd18b558ecd3bf77281ed0a
7
- data.tar.gz: 44402a6591987118f01cdc357e5b089625a0406850da4e8e2e16c8134a7571102d02f3594dc3d0212dc423115abf20b3b0a3e54acd8ee270e705904e66a8976a
6
+ metadata.gz: 2e1927abd0956bb9a001c690e2ab53789e443003a3eded4ead50f13281b7378a92bc837f5477c996c0f019e5232262dda2714c57e23d93a262faf436b09e389b
7
+ data.tar.gz: 4a46591f6322bed4702efea3531795b183514a467d8204f2abf6f0c82ee8ffc7b65cad608752fa38fa78aea1de4556d284c883ecbfeb5813bfc9fc065901cc18
@@ -1 +1,3 @@
1
- named
1
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam diam
2
+ urna, dignissim a faucibus eu, malesuada vitae tellus. Aliquam dignissim
3
+ volutpat fermentum. Nam ultricies risus ac ornare venenatis.
@@ -13,6 +13,12 @@ RSpec.describe "Example" do
13
13
  end
14
14
 
15
15
  it "takes a named snapshot" do
16
- expect("named").to match_snapshot("named.rspec.txt")
16
+ message = <<~EOS
17
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam diam
18
+ urna, dignissim a faucibus eu, malesuada vitae tellus. Aliquam dignissim
19
+ volutpat fermentum. Nam ultricies risus ac ornare venenatis.
20
+ EOS
21
+
22
+ expect(message).to match_snapshot("named.rspec.txt")
17
23
  end
18
24
  end
@@ -19,28 +19,24 @@ module SnapshotTesting
19
19
 
20
20
  matcher :match_snapshot do |name|
21
21
  match do |actual|
22
+ @actual = actual
22
23
  @expected = if name.nil?
23
24
  __snapshot_recorder__.record(actual)
24
25
  else
25
26
  __snapshot_recorder__.record_file(name, actual)
26
27
  end
27
28
 
28
- @expected == actual
29
+ @expected == @actual
29
30
  end
30
31
 
31
- diffable
32
- description { "match snapshot #{expected_formatted}"}
32
+ description { "match snapshot #{@expected.inspect}"}
33
33
 
34
- failure_message do |actual|
35
- "\nexpected: #{expected_formatted}\n got: #{actual_formatted}\n\n(compared using ==)\n"
36
- end
37
-
38
- def expected_formatted
39
- ::RSpec::Support::ObjectFormatter.format(@expected)
40
- end
34
+ failure_message do
35
+ diff = ::RSpec::Expectations.differ.diff(@actual, @expected)
41
36
 
42
- def actual_formatted
43
- ::RSpec::Support::ObjectFormatter.format(@actual)
37
+ message = "\nexpected: #{@expected.inspect}\n got: #{@actual.inspect}\n"
38
+ message = "#{message}\nDiff: #{diff}" unless diff.strip.empty?
39
+ message
44
40
  end
45
41
  end
46
42
  end
@@ -1,3 +1,3 @@
1
1
  module SnapshotTesting
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshot_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Zane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-26 00:00:00.000000000 Z
11
+ date: 2019-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler