lib/capybara/screenshot/diff.rb in capybara-screenshot-diff-0.10.2 vs lib/capybara/screenshot/diff.rb in capybara-screenshot-diff-0.11.0
- old
+ new
@@ -8,28 +8,29 @@
extend Os
mattr_accessor :add_driver_path
mattr_accessor :add_os_path
mattr_accessor :blur_active_element
mattr_accessor :enabled
- mattr_accessor(:screenshot_root) { (defined?(Rails.root) && Rails.root) || File.expand_path('.') }
+ mattr_accessor(:root) { (defined?(Rails.root) && Rails.root) || File.expand_path('.') }
mattr_accessor :stability_time_limit
mattr_accessor :window_size
+ mattr_accessor(:save_path) { 'doc/screenshots' }
class << self
def active?
enabled || (enabled.nil? && Diff.enabled)
end
def screenshot_area
- parts = ['doc/screenshots']
+ parts = [Capybara::Screenshot.save_path]
parts << Capybara.current_driver.to_s if Capybara::Screenshot.add_driver_path
parts << os_name if Capybara::Screenshot.add_os_path
File.join parts
end
def screenshot_area_abs
- "#{screenshot_root}/#{screenshot_area}".freeze
+ "#{root}/#{screenshot_area}".freeze
end
end
# Module to track screen shot changes
module Diff
@@ -37,9 +38,10 @@
include Capybara::Screenshot::Os
mattr_accessor :area_size_limit
mattr_accessor :color_distance_limit
mattr_accessor(:enabled) { true }
+ mattr_accessor :shift_distance_limit
def self.included(clas)
clas.include TestMethods
clas.setup do
if Capybara::Screenshot.window_size