Module: LooksGood::Configuration

Included in:
CaptureElement
Defined in:
lib/looks_good/configuration.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.browser_foldersObject

Returns the value of attribute browser_folders.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def browser_folders
  @browser_folders
end

.default_withinObject

Returns the value of attribute default_within.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def default_within
  @default_within
end

.fuzzObject

Returns the value of attribute fuzz.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def fuzz
  @fuzz
end

.max_no_triesObject

Returns the value of attribute max_no_tries.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def max_no_tries
  @max_no_tries
end

.pathsObject (readonly)

Returns the value of attribute paths.



11
12
13
# File 'lib/looks_good/configuration.rb', line 11

def paths
  @paths
end

.reference_image_pathObject

Returns the value of attribute reference_image_path.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def reference_image_path
  @reference_image_path
end

.scale_amountObject

allows retina mac screenshots to be scaled to expected size



23
24
25
# File 'lib/looks_good/configuration.rb', line 23

def scale_amount
  @scale_amount
end

.sleep_between_triesObject

Returns the value of attribute sleep_between_tries.



8
9
10
# File 'lib/looks_good/configuration.rb', line 8

def sleep_between_tries
  @sleep_between_tries
end

Class Method Details

.browserObject



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/looks_good/configuration.rb', line 67

def browser
  begin
    browser = Capybara.page.driver.browser.browser
  rescue
    browser = Selenium.page.driver.browser.browser
  rescue
    raise "Currently custom folders are only supported by Capybara"
    return nil
  end
  browser.to_s
end

.default_reference_pathObject



48
49
50
51
52
53
54
55
56
# File 'lib/looks_good/configuration.rb', line 48

def default_reference_path
  begin
    reference_image_path = File.join(Rails.root, 'spec/screenshots')
  rescue
    reference_image_path = 'spec/screenshots'
    puts "Currently defaulting to #{@reference_image_path}. Overide this by setting reference_image_path=[refpath] in your configuration block"
  end
  reference_image_path
end

.path(type) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/looks_good/configuration.rb', line 39

def path(type)
  paths =  {:reference => reference_image_path,
            :tmp => File.join(reference_image_path, 'tmp', 'tmp'),
            :candidate => File.join(reference_image_path, 'tmp', 'candidate'),
            :diff => File.join(reference_image_path, 'tmp', 'diff')
           }
  paths[type]
end

.reference_path_with_browser_foldersObject



58
59
60
61
62
63
64
65
# File 'lib/looks_good/configuration.rb', line 58

def reference_path_with_browser_folders
  begin
    reference_images_path = File.join(@reference_image_path, browser)
  rescue
    reference_images_path = @reference_image_path
  end
  reference_images_path
end