# encoding: UTF-8 require 'spec_helper' describe CrazyHarry::Truncate do let(:harry){ CrazyHarry } it "truncate by number of words" do harry.fragment('
text goes here
').truncate!(2).to_s.should == 'text goes…
' end it "closes html tags properly" do harry.fragment('text goes here
').truncate!(2).to_s.should == 'text goes…
' end it "passes extra options to HTML_Truncator" do harry.fragment('text goes here
').truncate!(10, length_in_chars: true, ellipsis: ' (...)').to_s .should == 'text goes (...)
' end end