Sha256: 77f36151b9684ddeccbe66dd939c9e1aa3eb45a2fef52c59fd8f2b6b1ca0d35e

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'

describe Tableficate::Caption do
  it 'should accept plain text in the arguments' do
    caption = Tableficate::Caption.new('Foo', {class: 'title'})

    caption.attrs[:class].should == 'title'
    caption.value.should == 'Foo'
  end

  it 'should take a block in place of the plain text argument' do
    caption = Tableficate::Caption.new({class: 'title'}) do
      'Foo'
    end

    caption.attrs[:class].should == 'title'
    caption.value.should == 'Foo'
  end
  it 'should not escape html in block outputs' do
    caption = Tableficate::Caption.new do
      '<b>Foo</b>'
    end

    ERB::Util::html_escape(caption.value).should == '<b>Foo</b>'
  end
  it 'should allow ERB tags in block outputs' do
    caption = Tableficate::Caption.new do
      ERB.new("<%= 'Foo'.upcase %>").result(binding)
    end

    caption.value.should == 'FOO'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tableficate-0.3.2 spec/caption_spec.rb
tableficate-0.3.1 spec/caption_spec.rb
tableficate-0.3.0 spec/caption_spec.rb