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-core-1.1.3 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/core_ext_spec.rb
merb-helpers-1.0.15 spec/core_ext_spec.rb
merb-helpers-1.0.14 spec/core_ext_spec.rb
merb-helpers-1.0.13 spec/core_ext_spec.rb
merb-helpers-1.0.12 spec/core_ext_spec.rb
merb-helpers-0.9.10 spec/core_ext_spec.rb
merb-helpers-1.0.10 spec/core_ext_spec.rb
merb-helpers-1.0.11 spec/core_ext_spec.rb
merb-helpers-1.0.2 spec/core_ext_spec.rb
merb-helpers-1.0.5 spec/core_ext_spec.rb
merb-helpers-0.9.11 spec/core_ext_spec.rb
merb-helpers-0.9.12 spec/core_ext_spec.rb
merb-helpers-0.9.13 spec/core_ext_spec.rb
merb-helpers-0.9.8 spec/core_ext_spec.rb
merb-helpers-1.0.1 spec/core_ext_spec.rb