looks_good 1.1.2 → 1.1.5

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
  SHA256:
3
- metadata.gz: 1a2cf1760fd599b771bfe2b55c718fca9e03c8d459318a70f73c63a345f17dc8
4
- data.tar.gz: ee2e7f9cfaaf10dad37a9be5798ebb91dbf39d6f6f50200b450a1a8d1813bdc1
3
+ metadata.gz: b30259ff1ba4dca90e415d267de2041780a053a37b986a455b913eb7492cc5c6
4
+ data.tar.gz: 25bfe1e8a7547ce85166b2c9c59b4a644cf680a54743b850c33b559e251c3106
5
5
  SHA512:
6
- metadata.gz: 1671d110b1c073910e0d5c9badca57f3bb4e04151f656cfe2479d562f89bb4e2abd2d189f91c96f87ba6a2211d28707bbd4c2c39a756492e563ed38ff8a78795
7
- data.tar.gz: 6beb0ebc7a689f6eea1c04a5bd9d385c8666a5941415b6c1f1ac3d56fc196a104cbb820c97eb818d18b459e514dd3e9d9c5050613476d1b4a7b43d3d42071efe
6
+ metadata.gz: c2ea8affedd87911371b67726c9c96e14bdee69101f65f094287eda0c69687aeb5d8ffb219f2c8da109f27b8ffab128643a429f1af0efb6af8f45328c4be8ad2
7
+ data.tar.gz: 6ff0757d1ab5fc29ae8e60bafd74b1456c5f646871159da0010021d90c73b4ec9dc4261eef7f6e752de3483fc1e125455c7031110e79d7d0ffcfee3955014ac0
data/README.md CHANGED
@@ -63,6 +63,7 @@ you can override any of the defaults with a config block.
63
63
  c.sleep_between_tries = 0.5
64
64
  c.browser_folders = false
65
65
  c.scale_amount = 0.5
66
+ c.disable_scling = true
66
67
  c.fuzz = "10%"
67
68
  end
68
69
 
@@ -87,7 +88,13 @@ Also created are subfolders:
87
88
  - allows pixels to not need to match exactly. a string percentage value, provided to imagemagick as fuzz value for comparison. default is "10%"
88
89
 
89
90
  #### scale_amount
90
- - Retina mac screenshots are 2x actual size, so this scales them to be 1:1. default is 0.5, set to 1 to disable.
91
+ - Retina mac screenshots are 2x actual size, so this scales them to be 1:1. default is 0.5.
92
+
93
+ #### disable_scaling
94
+ set to true to disable the scaling behavior
95
+
96
+ #### custom_error_message
97
+ When the spec fails, this message will be appended to the failure.
91
98
 
92
99
  #### Sleep_between_tries
93
100
  - sets the sleep time (in seconds) between match tries (requires max_no_tries > 1). Defaults to 0.5
@@ -39,7 +39,8 @@ module LooksGood
39
39
  end
40
40
 
41
41
  def self.crop_element(image, element_to_crop, position)
42
- cropped_element = image.scale!(LooksGood::Configuration.scale_amount).crop!(position[:x], position[:y], position[:width], position[:height])
42
+ image.scale!(LooksGood::Configuration.scale_amount) unless LooksGood::Configuration.disable_scaling
43
+ cropped_element = image.crop!(position[:x], position[:y], position[:width], position[:height])
43
44
  end
44
45
 
45
46
  end
@@ -5,7 +5,8 @@ module LooksGood
5
5
 
6
6
  class << self
7
7
 
8
- attr_accessor :fuzz, :reference_image_path, :max_no_tries, :sleep_between_tries, :browser_folders, :default_within
8
+ attr_accessor :fuzz, :reference_image_path, :max_no_tries, :sleep_between_tries,
9
+ :browser_folders, :default_within, :scale_amount, :disable_scaling
9
10
 
10
11
  attr_reader :paths
11
12
 
@@ -27,6 +28,14 @@ module LooksGood
27
28
  @max_no_tries ||= 2
28
29
  end
29
30
 
31
+ def disable_scaling
32
+ @disable_scaling ||= false
33
+ end
34
+
35
+ def custom_failure_message
36
+ @custom_failure_message ||= ""
37
+ end
38
+
30
39
  def fuzz
31
40
  @fuzz ||= "10%"
32
41
  end
@@ -1,3 +1,3 @@
1
1
  module LooksGood
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.5"
3
3
  end
data/lib/looks_good.rb CHANGED
@@ -39,7 +39,9 @@ module LooksGood
39
39
  HOW TO FIX:\n
40
40
  - cp #{comparison.diff_image.path(:candidate)} #{@expected_reference_file}
41
41
  or
42
- - LOOKS_GOOD=true rspec ...]
42
+ - LOOKS_GOOD=true rspec ...
43
+ --
44
+ #{LooksGood::LooksGood::Configuration.custom_failure_message}]
43
45
  result_hash[:result] = false
44
46
  result_hash
45
47
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looks_good
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Jennings
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-12 00:00:00.000000000 Z
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick