Sha256: e31e36927fed2f53b9a74197d521dc155f8ff016e79471c26d2cf5d3feb5423a

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

require 'test_helper'

class ArticleHelperTest < ActionView::TestCase

  test "text shortening" do
    text = 'This text here should remain. This still has to remain after shortening. But this should not.'

    shortened_text = shorten_text(text, number_of_characters = 70, more_link = '..')
    assert_equal 'This text here should remain. This still has to remain after shortening...', shortened_text
  end

  test "text shortening with nill or empty text" do
    assert_equal '', shorten_text(nil)
    assert_equal '', shorten_text('')
  end

  test "test shortener should return the same text if it short" do
    assert_equal 'this is short', shorten_text('this is short', 20)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solarsearch-0.0.6 test/unit/helpers/article_helper_test.rb