Sha256: 337d12036de20025ef860c939695306694e4e98bbe4570d9cd961014aa76c491

Contents?: true

Size: 800 Bytes

Versions: 17

Compression:

Stored size: 800 Bytes

Contents

require "spec_helper"

module Refinery
  describe HtmlTruncationHelper do

    describe "#truncate" 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("<p>Turducken frankfurter ham hock bacon</p>",
                          :preserve_html_tags => true).should eq("<p>Turducken frankfurter ham...</p>")
        end
      end

      context "when preserve_html_tags option is not present" do
        it "falls back to original truncate method" do
          helper.truncate("<p>Turducken frankfurter ham hock bacon</p>").should eq("<p>Turducken frankfurter ha...")
        end
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
refinerycms-core-2.1.5 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.1.4 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.1.3 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.1.2 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.1.1 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.1.0 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.10 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.9 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.8 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.7 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.6 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.5 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.4 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.3 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.2 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.1 spec/helpers/refinery/html_truncation_helper_spec.rb
refinerycms-core-2.0.0 spec/helpers/refinery/html_truncation_helper_spec.rb