Sha256: f0e6073afbe07126a457d510a84700294b418b9eefc73c835ebe1c228a2fc470

Contents?: true

Size: 998 Bytes

Versions: 11

Compression:

Stored size: 998 Bytes

Contents

module WatirSpec
  class Implementation

    attr_writer :name, :guard_proc, :browser_class
    attr_accessor :browser_args

    def initialize
      @guard_proc = nil
    end

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

    def name
      @name || raise("implementation name not set")
    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
      caps = browser_args.last.delete(:desired_capabilities).send(:capabilities)
      string = "driver: #{browser_args.first}\n"
      browser_args.last.each { |arg| string << "#{arg.inspect}\n" }
      string << "capabilities:\n"
      caps.each { |k, v| string << "\t#{k}: #{v}\n"}
      string
    end
  end # Implementation
end # WatirSpec

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
watir-6.5.0 lib/watirspec/implementation.rb
watir-6.4.3 lib/watirspec/implementation.rb
watir-6.4.2 lib/watirspec/implementation.rb
watir-6.4.1 lib/watirspec/implementation.rb
watir-6.4.0 lib/watirspec/implementation.rb
watir-6.4.0.rc2 lib/watirspec/implementation.rb
watir-6.4.0.rc1 lib/watirspec/implementation.rb
watir-6.3.0 lib/watirspec/implementation.rb
watir-6.2.1 lib/watirspec/implementation.rb
watir-6.2.0 lib/watirspec/implementation.rb
watir-6.1.0 lib/watirspec/implementation.rb