diff --git a/core/lib/refinery/core.rb b/core/lib/refinery/core.rb index 31ab01c078..7093568207 100644 --- a/core/lib/refinery/core.rb +++ b/core/lib/refinery/core.rb @@ -1,7 +1,6 @@ require 'rails/all' require 'rbconfig' require 'acts_as_indexed' -require 'truncate_html' require 'will_paginate' module Refinery diff --git a/core/spec/helpers/refinery/html_truncation_helper_spec.rb b/core/spec/helpers/refinery/html_truncation_helper_spec.rb new file mode 100644 index 0000000000..a53f2ea55c --- /dev/null +++ b/core/spec/helpers/refinery/html_truncation_helper_spec.rb @@ -0,0 +1,24 @@ +require "spec_helper" + +module Refinery + describe HtmlTruncationHelper do + + it "returns nil if text is not present" do + helper.truncate("").should be_nil + end + + context "when preserve_html_tags option is present" do + it "preserve html tags when truncating text" do + helper.truncate("

Turducken frankfurter ham hock bacon

", + :preserve_html_tags => true).should eq("

Turducken frankfurter ham...

") + end + end + + context "when preserve_html_tags option is not present" do + it "falls back to original truncate method" do + helper.truncate("

Turducken frankfurter ham hock bacon

").should eq("

Turducken frankfurter ha...") + end + end + + end +end