Sha256: 33f016ff0a6df4e16dc3a4acd255aa71ab050b3ed71392cbbf888eac2600c109

Contents?: true

Size: 1.58 KB

Versions: 16

Compression:

Stored size: 1.58 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe ProxyPac::HTMLTableStyle do
  it 'produces a table' do
    data1 = double('DataHTML')
    allow(data1).to receive(:element).and_return('1st data')
    allow(data1).to receive(:header).and_return('1st header')
    allow(data1).to receive(:header_css_class).and_return('header')
    allow(data1).to receive(:element_css_class).and_return('element')

    data2 = double('DataHTML')
    allow(data2).to receive(:element).and_return('2nd data')
    allow(data2).to receive(:header).and_return('2nd header')
    allow(data2).to receive(:header_css_class).and_return('header')
    allow(data2).to receive(:element_css_class).and_return('element')

    style = ProxyPac::HTMLTableStyle.new(main_container_css_class: 'main_container', element_container_css_class: 'element_container')
    style.add_data(data1)
    style.add_data(data2)

    expected_result = <<-EOS.strip_heredoc.chomp
       <table class="main_container">
         <tr class="element_container">
           <th>
             <span class="header">
              1st header
              </span>
           </th>
           <th>
             <span class="header">
              2nd header
              </span>
           </th>
         </tr>
         <tr class="element_container">
           <td>
             <span class="element">
              1st data
              </span>
           </td>
           <td>
             <span class="element">
              2nd data
              </span>
           </td>
         </tr>
       </table>
    EOS


    expect(style.to_s).to eq(expected_result)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.10.1 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.10.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.9.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.7.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.6.3 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.6.2 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.6.1 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.5.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.4.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.3.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.2.3 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.2.2 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.2.1 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.2.0 spec/proxy_pac/html_table_style_spec.rb
local_pac-0.1.13 spec/proxy_pac/html_table_style_spec.rb