Sha256: 91542a7d12bd1c199955c8b1d43f886403dfba39057e2d9045652221021d74f1

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

describe CrazyHarry do

  let(:harry) { CrazyHarry }

  it "should allow method chaining" do
    harry.fragment('<script>STEAL COOKIE!</script><em>Place</em><p>Lodging</p><b>Location:</b> Warsaw')
      .redact!( unsafe: true, tags: 'em' )
      .change!( from: 'b', to: 'h3' )
      .truncate!(3, ellipsis: '...')
      .translate!( from_text: 'Lodging', to_text: 'Hotel', add_attributes: { class: 'partner' } )
      .to_s.should == 'Place <p class="partner">Hotel</p><h3 class="partner">Location:</h3>...'
  end

  it "should not care about the chain order" do
    harry.fragment('<script>STEAL COOKIE!</script><em>Place</em><p>Lodging</p><b>Location:</b>')
      .translate!( from_text: 'Lodging', to_text: 'Hotel', add_attributes: { class: 'partner' } )
      .redact!( unsafe: true, tags: 'em' )
      .change!( from: 'b', to: 'h3' )
      .truncate!(3)
      .to_s.should == 'Place <p class="partner">Hotel</p><h3 class="partner">Location:</h3>'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crazy_harry-0.2.0 spec/integration/crazy_harry_spec.rb