Sha256: 1b342aafc875360b99175ca2ada1b0a67dfeca7046529749b7866157f8c9c3c9

Contents?: true

Size: 525 Bytes

Versions: 7

Compression:

Stored size: 525 Bytes

Contents

require 'ostruct'

# Replaces watir table in WatirCraft unit tests
class FakeTable
  attr_accessor :rows
  def initialize structure
    @rows = structure.map {|hash| FakeRow.new(hash)}
  end
end

class FakeRow
  def initialize hash
    @hash = hash
  end
  def element name
    FakeElement.new @hash, name
  end
end

class FakeElement
  def initialize hash, name
    @hash = hash
    @name = name
  end
  def display_value
    @hash[@name]
  end
  def exist?
    true
  end
  def set value
    @hash[@name] = value
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bret-watircraft-0.4.0 spec/fake_table.rb
bret-watircraft-0.4.1 spec/fake_table.rb
bret-watircraft-0.4.2 spec/fake_table.rb
bret-watircraft-0.4.3 spec/fake_table.rb
bret-watircraft-0.4.4 spec/fake_table.rb
bret-watircraft-0.4.5 spec/fake_table.rb
bret-watircraft-0.5.0 spec/fake_table.rb