Sha256: d56345e05b20373d7ddabbadfd94fad781242ac5b869a0849588f8f6fbbaa5ad

Contents?: true

Size: 570 Bytes

Versions: 126

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

RSpec.describe :truncate_words do
  link :truncate_words, from: :ree_string

  it {
    expect(
      truncate_words('Once upon a time in a world far far away', 4)
    ).to eq("Once upon a time...")

    expect(
      truncate_words('Once<br>upon<br>a<br>time<br>in<br>a<br>world', 5, separator: '<br>')
    ).to eq("Once<br>upon<br>a<br>time<br>in...")

    expect(
      truncate_words('And they found that many people were sleeping better.', 5, omission: '... (continued)')
    ).to eq("And they found that many... (continued)")
  }
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
ree_lib-1.1.1 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.1.0 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.124 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_string/spec/ree_string/functions/truncate_words_spec.rb