Sha256: d5369045ca2abf99922d1df7ad1220a6ab105c4f60f45254594334d6fa81c1e1

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

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

  let(:args) { [] }

  subject { described_class.new text, *args }

  its(:text)   { should == text }

  its(:length) { should == 30 }

  its(:separator) { should be_nil }

  its(:trailing) { should == '…' }

  context 'custom values' do
    let(:args) { [45, { :separator => ' ', :trailing => '...' }]}

    its(:length) { should == 45 }

    its(:separator) { should == ' ' }

    its(:trailing) { should == '...' }
  end
end # initialize

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/text/truncation/initialize_spec.rb
tty-0.0.10 spec/tty/text/truncation/initialize_spec.rb
tty-0.0.9 spec/tty/text/truncation/initialize_spec.rb
tty-0.0.8 spec/tty/text/truncation/initialize_spec.rb
tty-0.0.7 spec/tty/text/truncation/initialize_spec.rb