Sha256: 7766bf744d93b0ba6488026983d7e0dd9f29f07a037825c169f620f4e99325f9
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
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 it "should not care about repetition when dupes are preserved" do harry.fragment('<script>STEAL COOKIE!</script><em>Place</em><p>Lodging</p><b>Location:</b><p>Lodging</p>', preserve_dupes: true) .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><p class="partner">Hotel</p>' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crazy_harry-0.2.1 | spec/integration/crazy_harry_spec.rb |