Sha256: cbb8d4f37a10256edc27d9397e47ac409fa699a1c4bd3941e8bc4c9b94628e19

Contents?: true

Size: 892 Bytes

Versions: 4

Compression:

Stored size: 892 Bytes

Contents

describe DaruLite::MultiIndex, '#to_html' do
  let(:index) {
    DaruLite::MultiIndex.from_tuples [
      [:a,:one,:bar],
      [:a,:one,:baz],
      [:a,:two,:bar],
      [:a,:two,:baz],
      [:b,:one,:bar],
      [:b,:two,:bar],
      [:b,:two,:baz],
      [:b,:one,:foo],
      [:c,:one,:bar],
      [:c,:one,:baz],
      [:c,:two,:foo],
      [:c,:two,:bar]
    ]
  }

  let(:table) { Nokogiri::HTML(index.to_html) }

  describe 'first row' do
    subject { table.at('tr:first-child > th') }
    its(['colspan']) { is_expected.to eq '3' }
    its(:text) { is_expected.to eq 'DaruLite::MultiIndex(12x3)' }
  end

  describe 'next row' do
    let(:row) { table.at('tr:nth-child(2)') }
    subject { row.inner_html.scan(/<th.+?<\/th>/) }

    it { is_expected.to eq [
        '<th rowspan="4">a</th>',
        '<th rowspan="2">one</th>',
        '<th rowspan="1">bar</th>'
    ]}
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daru_lite-0.1.3 spec/iruby/multi_index_spec.rb
daru_lite-0.1.2 spec/iruby/multi_index_spec.rb
daru_lite-0.1.1 spec/iruby/multi_index_spec.rb
daru_lite-0.1 spec/iruby/multi_index_spec.rb