looks_good 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/looks_good/configuration.rb +2 -2
- data/lib/looks_good/matchers/look_like_matcher.rb +2 -2
- data/lib/looks_good/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 453e5498b4740e2fe1c415307921f1acaf410c7d6f6395ea531916249c30792a
|
4
|
+
data.tar.gz: 3f08a7bb2ccb8d860072783bc7dc3fd96fa528a8826d8d1a2f2e401bdb94cb99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9b731e277ff3015ef89693bb4595e7c4d1346bd244615e989e57ea4395a055d73239ec16cd88721052d8154b5edc38720f5ecff18a64d055dbf2408d8f92d9d
|
7
|
+
data.tar.gz: 58cd545954d8d637f5577184f2d2c39c57716c48ecf86237df7c86ba96b86b70a52d29a9978ab390714db1182cc1b75fb68ab5b3a8829ebdb4b60e22e3c68954
|
data/README.md
CHANGED
@@ -78,10 +78,10 @@ Also created are subfolders:
|
|
78
78
|
- tmp/diff/ - will hold the visual diff images for inspection when comparison fails
|
79
79
|
|
80
80
|
#### max_no_tries
|
81
|
-
- sets how many times looks_good will try and match the element against the reference image. Handy to reduce fragility of tests due to animations and load times. Defaults to
|
81
|
+
- sets how many times looks_good will try and match the element against the reference image. Handy to reduce fragility of tests due to animations and load times. Defaults to 2.
|
82
82
|
|
83
83
|
#### default_within
|
84
|
-
- a float between 0 and 1 that sets the default tolerance for visual differences. default is 0.
|
84
|
+
- a float between 0 and 1 that sets the default tolerance for visual differences. default is 0.0001, which is strict but not absolute 0. Larger screenshots will be less sensitive to subtle differences as a percentage.
|
85
85
|
|
86
86
|
#### fuzz
|
87
87
|
- allows pixels to not need to match exactly. a string percentage value, provided to imagemagick as fuzz value for comparison. default is "10%"
|
@@ -15,7 +15,7 @@ module LooksGood
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def default_within
|
18
|
-
@default_within ||= 0.
|
18
|
+
@default_within ||= 0.0001
|
19
19
|
end
|
20
20
|
|
21
21
|
# allows retina mac screenshots to be scaled to expected size
|
@@ -24,7 +24,7 @@ module LooksGood
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def max_no_tries
|
27
|
-
@max_no_tries ||=
|
27
|
+
@max_no_tries ||= 2
|
28
28
|
end
|
29
29
|
|
30
30
|
def fuzz
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'looks_good'
|
2
2
|
|
3
|
-
RSpec::Matchers.define :look_like do |expected|
|
3
|
+
RSpec::Matchers.define :look_like do |expected, within: LooksGood::Configuration.default_within|
|
4
4
|
result = nil
|
5
5
|
match do |actual|
|
6
6
|
if expected.is_a?(Symbol)
|
@@ -8,7 +8,7 @@ RSpec::Matchers.define :look_like do |expected|
|
|
8
8
|
path_to = called_by_file.split("_spec.rb").first.split("spec/").last
|
9
9
|
expected = File.join(path_to, "#{expected}.png")
|
10
10
|
end
|
11
|
-
result = LooksGood.check(expected, actual)
|
11
|
+
result = LooksGood.check(expected, actual, within: within)
|
12
12
|
result[:result]
|
13
13
|
end
|
14
14
|
|
data/lib/looks_good/version.rb
CHANGED