Sha256: 7d76a05ae34041333fbc2f5d070e6f1275edb047a5c599670bc4e6ccf36eba7e

Contents?: true

Size: 486 Bytes

Versions: 31

Compression:

Stored size: 486 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "String" do
  before :each do
    @str = "This is a fairly long string to test with!"
  end

  it "should default to appending ..." do
    @str.truncate(5).should == "Th..."
  end

  it "should default to a length of 30" do
    @str.truncate().should == "This is a fairly long strin..."
  end

  it "should truncate to a given length with a given suffix" do
    @str.truncate(15, "--more").should == "This is a--more"
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
merb-helpers-0.9.9 spec/core_ext_spec.rb
merb-helpers-1.0.6.1 spec/core_ext_spec.rb
merb-helpers-1.0.3 spec/core_ext_spec.rb
merb-helpers-1.0.4 spec/core_ext_spec.rb
merb-helpers-1.0.6 spec/core_ext_spec.rb
merb-helpers-1.0.8.1 spec/core_ext_spec.rb
merb-helpers-1.0.7.1 spec/core_ext_spec.rb
merb-helpers-1.0 spec/core_ext_spec.rb
merb-helpers-1.0.8 spec/core_ext_spec.rb
merb-helpers-1.0.9 spec/core_ext_spec.rb
merb-helpers-1.0.7 spec/core_ext_spec.rb