Sha256: b52313abc886ef1f891f2f8ace42c173a20400c2e891c1d5f83e01dbf6d9bc28
Contents?: true
Size: 600 Bytes
Versions: 2
Compression:
Stored size: 600 Bytes
Contents
# encoding: UTF-8 require 'spec_helper' describe CrazyHarry::Truncate do let(:harry){ CrazyHarry } it "truncate by number of words" do harry.fragment('<p>text goes here</p>').truncate!(2).to_s.should == '<p>text goes…</p>' end it "closes html tags properly" do harry.fragment('<p>text <b>goes here</b></p>').truncate!(2).to_s.should == '<p>text <b>goes</b>…</p>' end it "passes extra options to HTML_Truncator" do harry.fragment('<p>text goes here</p>').truncate!(10, length_in_chars: true, ellipsis: ' (...)').to_s .should == '<p>text goes (...)</p>' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crazy_harry-0.2.1 | spec/lib/truncate_spec.rb |
crazy_harry-0.2.0 | spec/lib/truncate_spec.rb |