Sha256: 6e19baa7c0e7d6574514de1c586b6b67dacb0b46e2c33468d528039cadb6af1f

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 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>')
      .redact!( unsafe: true, tags: 'em' )
      .change!( from: 'b', to: 'h3' )
      .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' )
      .to_s.should == 'Place <p class="partner">Hotel</p><h3 class="partner">Location:</h3>'
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
crazy_harry-0.1.2 spec/integration/crazy_harry_spec.rb
crazy_harry-0.1.0 spec/integration/crazy_harry_spec.rb
crazy_harry-0.0.4 spec/integration/crazy_harry_spec.rb
crazy_harry-0.0.3 spec/integration/crazy_harry_spec.rb