Sha256: e8b8ea90a5febb0fa7da05eed0c82520a80b5314bd1e89bb0233ca3c80d0651a

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

module Diagnostics
  module Data
    describe Table do
      describe '#html' do

        specify do
          described_class.new(
            { 'heading 1' => [1, 2, 3],
              'heading 2' => [4, 5, 6],
              'heading 3' => [7, 8, 9] }
          ).html.should eq(
            '<table>' \
              '<tr>' \
                '<th>heading 1</th>' \
                '<th>heading 2</th>' \
                '<th>heading 3</th>' \
              '</tr>' \
              '<tr>' \
                '<td>1</td>' \
                '<td>4</td>' \
                '<td>7</td>' \
              '</tr>' \
              '<tr>' \
                '<td>2</td>' \
                '<td>5</td>' \
                '<td>8</td>' \
              '</tr>' \
              '<tr>' \
                '<td>3</td>' \
                '<td>6</td>' \
                '<td>9</td>' \
              '</tr>' \
            '</table>'
          )
        end

        specify do
          described_class.new(
            { 'heading 1' => 1,
              'heading 2' => 2,
              'heading 3' => 3 }
          ).html.should eq(
            '<table>' \
              '<tr>' \
                '<th>heading 1</th>' \
                '<th>heading 2</th>' \
                '<th>heading 3</th>' \
              '</tr>' \
              '<tr>' \
                '<td>1</td>' \
                '<td>2</td>' \
                '<td>3</td>' \
              '</tr>' \
            '</table>'
          )
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
diagnostics-0.0.4 spec/diagnostics/data/table_spec.rb
diagnostics-0.0.3 spec/diagnostics/data/table_spec.rb
diagnostics-0.0.2 spec/diagnostics/data/table_spec.rb