Sha256: 61624a5b03679f3a79173f1a6856fe21eb3ea85d5e1f38f37d27ee2acfbe8684

Contents?: true

Size: 511 Bytes

Versions: 14

Compression:

Stored size: 511 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "../..", "example_helper.rb"))

describe "Relevance::CoreExtensions::Object#ellipsize" do
  it "converts nil to empty string" do
    nil.ellipsize.should == ""
  end
  
  it "doesn't touch short strings" do
    "hello".ellipsize.should == "hello"
  end
  
  it "calls inspect on non-strings" do
    [1,2,3].ellipsize.should == "[1, 2, 3]"
  end

  it "shortens long strings and adds ..." do
    "long-string".ellipsize(5).should == "long-..."
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
relevance-tarantula-0.1.6 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.7 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.8 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.2.0 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.2.1 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.3.2 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.3.3 examples/relevance/core_extensions/ellipsize_example.rb
romanbsd-tarantula-0.1.8 examples/relevance/core_extensions/ellipsize_example.rb
romanbsd-tarantula-0.2.0 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-rails3-0.3.3 examples/relevance/core_extensions/ellipsize_example.rb
panmind-tarantula-0.3.3 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-0.3.3 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-0.1.8 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-0.2.0 examples/relevance/core_extensions/ellipsize_example.rb