Sha256: 4de28ca9e13a76fc6fe7ce56861cff9b753a68f98b690bbe79f0b79045d6d20c

Contents?: true

Size: 795 Bytes

Versions: 7

Compression:

Stored size: 795 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe Verse::Truncation, '#new' do
  let(:text) { 'There go the ships; there is that Leviathan whom thou hast made to play therein.'}

  it "defaults to no separator and unicode trailing" do
    truncation = Verse::Truncation.new text
    expect(truncation.separator).to eq(nil)
  end

  it "defaults to unicode trailing" do
    truncation = Verse::Truncation.new text
    expect(truncation.trailing).to eq('…')
  end


  it "allows to setup global separator value" do
    truncation = Verse::Truncation.new text, separator: ' '
    expect(truncation.separator).to eq(' ')
  end

  it "allows to setup global trailing value" do
    truncation = Verse::Truncation.new text, trailing: '...'
    expect(truncation.trailing).to eq('...')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
verse-0.5.0 spec/unit/truncation/new_spec.rb
verse-0.4.0 spec/unit/truncation/new_spec.rb
verse-0.3.0 spec/unit/truncation/new_spec.rb
verse-0.2.1 spec/unit/truncation/new_spec.rb
verse-0.2.0 spec/unit/truncation/new_spec.rb
verse-0.1.1 spec/unit/truncation/new_spec.rb
verse-0.1.0 spec/unit/truncation/new_spec.rb