lib/simulacrum/configuration.rb in simulacrum-0.1.1 vs lib/simulacrum/configuration.rb in simulacrum-0.3.0

- old
+ new

@@ -1,38 +1,37 @@ +# encoding: UTF-8 require 'ostruct' module Simulacrum + # Configuration Class for managing config of the suite class Configuration - COMPONENT_DEFAULTS = { - acceptable_delta: 1, + delta_threshold: 1, window_size: [1024, 768], capture_delay: nil, - capture_selector: :html, + capture_selector: :html } attr_reader :references_path, :reference_filename, :candidate_filename, - :diff_filename, :acceptable_delta, :capture_delay, :window_size, - :capture_selector, :default_browser + :diff_filename, :delta_threshold, :capture_delay, + :window_size, :capture_selector, :default_browser def initialize - @config = OpenStruct.new(defaults: OpenStruct.new(COMPONENT_DEFAULTS)) + @config = OpenStruct.new(component: OpenStruct.new(COMPONENT_DEFAULTS)) end def configure(config) @config = OpenStruct.new(@config.to_h.merge!(config)) end - def default_browser - @config.default_browser || :selenium - end - def references_path if @config.references_path @config.references_path elsif defined?(Rails) File.join(Rails.root, 'spec/ui/references') + else + 'spec/ui/references' end end def reference_filename @config.reference_filename || 'reference' @@ -44,14 +43,22 @@ def diff_filename @config.diff_filename || 'diff' end - def acceptable_delta - @config.defaults.acceptable_delta || 0.0 + def delta_threshold + @config.component.delta_threshold || 0.0 end def capture_selector - @config.defaults.capture_selector || nil + @config.component.capture_selector || nil + end + + def build_name + @config.build_name || '' + end + + def project_name + @config.project_name || 'Simulacrum' end end end