Sha256: e36ae78894536cd4d079cc809e79e519461c0da642f7deef1530242f1f6b2f15

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

module WatirSpec
  class Implementation
    attr_writer :name, :guard_proc, :browser_class
    attr_accessor :browser_args, :driver_info

    def initialize
      @guard_proc = nil
    end

    def initialize_copy(_orig)
      @browser_args = browser_args.map(&:dup)
    end

    def browser_class
      @browser_class || raise('browser_class not set')
    end

    def name
      @name || raise('implementation name not set')
    end

    def browser_name
      browser_args.first == :ie ? :internet_explorer : browser_args.first
    end

    def matches_guard?(args)
      return @guard_proc.call(args) if @guard_proc

      args.include? name
    end

    def matching_guards_in(guards)
      result = []
      guards.each { |args, data| data.each { |d| result << d } if args.empty? || matches_guard?(args) }

      result
    end

    def inspect_args
      hash = browser_args.last
      desired_capabilities = hash.delete(:desired_capabilities)
      string = ''
      hash.each { |arg| string << "#{arg.inspect}\n" }
      return "#{string} default capabilities" unless desired_capabilities

      string << "\tcapabilities:\n"
      caps.each { |k, v| string << "\t\t#{k}: #{v}\n" }
      hash[:desired_capabilities] = desired_capabilities
      string
    end
  end # Implementation
end # WatirSpec

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
watir-7.1.0 lib/watirspec/implementation.rb
watir-7.0.0 lib/watirspec/implementation.rb
watir-7.0.0.beta5 lib/watirspec/implementation.rb
watir-7.0.0.beta4 lib/watirspec/implementation.rb
watir-7.0.0.beta3 lib/watirspec/implementation.rb
watir-7.0.0.beta2 lib/watirspec/implementation.rb
watir-7.0.0.beta1 lib/watirspec/implementation.rb