Sha256: 53390b1db548d404df42b2629e7ffea626d5134d45036fc29452f2bde7d4f8bb

Contents?: true

Size: 880 Bytes

Versions: 8

Compression:

Stored size: 880 Bytes

Contents

describe Daru::MultiIndex, '#to_html' do
  let(:index) {
    Daru::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 'Daru::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

8 entries across 8 versions & 1 rubygems

Version Path
daru-0.3 spec/iruby/multi_index_spec.rb
daru-0.2.2 spec/iruby/multi_index_spec.rb
daru-0.2.1 spec/iruby/multi_index_spec.rb
daru-0.2.0 spec/iruby/multi_index_spec.rb
daru-0.1.6 spec/iruby/multi_index_spec.rb
daru-0.1.5 spec/iruby/multi_index_spec.rb
daru-0.1.4.1 spec/iruby/multi_index_spec.rb
daru-0.1.4 spec/iruby/multi_index_spec.rb