Sha256: e4d61caf6ba8305d0c97aac18b46d3ed852fd93aa45aeb05f5c3df4fad8cc1dc

Contents?: true

Size: 493 Bytes

Versions: 8

Compression:

Stored size: 493 Bytes

Contents

require 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

8 entries across 8 versions & 2 rubygems

Version Path
relevance-tarantula-0.1.0 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.1 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.2 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.3 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.4 examples/relevance/core_extensions/ellipsize_example.rb
relevance-tarantula-0.1.5 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-0.1.4 examples/relevance/core_extensions/ellipsize_example.rb
tarantula-0.1.5 examples/relevance/core_extensions/ellipsize_example.rb