Sha256: c9190af34964027a734418b81badf8365af67e31a49ab0ca56e0af9e094f9918

Contents?: true

Size: 949 Bytes

Versions: 6

Compression:

Stored size: 949 Bytes

Contents

require 'spec_helper'

describe Mohawk::Adapters::UIA::TableRow do
  let(:table) { double 'table', element: table_element }
  let(:table_element) { double 'table element', row_at: element }
  let(:element) { double 'row Element' }

  subject { Mohawk::Adapters::UIA::TableRow.new table, 123 }

  def set_expected_cells(h)
    element.stub(:items).and_return h.values.map {|v| UiaTableCell.new v }
    table.stub(:headers).and_return h.keys.map(&:to_s)
  end

  context '#all_match?' do
    it 'matches string values' do
      set_expected_cells 'First Column' => 'Yo'

      expect(subject).to be_all_match first_column: 'Yo'
    end

    it 'matches non-string values' do
      set_expected_cells 'Date Field' => Date.today.to_s

      expect(subject).to be_all_match date_field: Date.today
    end
  end

  class UiaTableCell
    attr_reader :name

    def initialize(name)
      @name = name
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mohawk-0.4.2 spec/lib/mohawk/adapters/uia/table_row_spec.rb
mohawk-0.4.1 spec/lib/mohawk/adapters/uia/table_row_spec.rb
mohawk-0.4 spec/lib/mohawk/adapters/uia/table_row_spec.rb
mohawk-0.3 spec/lib/mohawk/adapters/uia/table_row_spec.rb
mohawk-0.2.1 spec/lib/mohawk/adapters/uia/table_row_spec.rb
mohawk-0.2 spec/lib/mohawk/adapters/uia/table_row_spec.rb