require 'spec_helper' describe CrazyHarry::Change do # Change br to p # Change b to h3 where b has text: "location" # Change b to em where b inside p # # Add attribute: "partner" to all tags # # Another ADS suggestion. Not sure it if it needed for the first cut. # Transform "lodging" to "hotel" context "change" do let(:harry){ CrazyHarry } it "should be able to change one tag to another" do harry.fragment( 'Location:' ).change!( from: 'b', to: 'h3' ).to_s.should == '

Location:

' end it "should unwrap unnecessary paragraphs" do harry.fragment('

Header

').change!(from: 'strong', to: 'h3').to_s.should == '

Header

' end it "should not unwrap paragraphs indiscriminately" do harry.fragment('

Header
Content

').change!(from: 'b', to: 'h3').to_s.should == '

Header

Content

' end it "should wrap orphaned list items" do harry.fragment('

  • orphan