Sha256: f42e86862bd7fcef65f4bd49f642728dbcc78a933af5f5b99e0694bda0ddb779

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

require_relative '../spec_helper'

module LovelyRufus describe OneLetterGluer do
  describe '#call' do
    it 'replaces spaces after one-letter words with non-break spaces' do
      text = 'I go crazy when I hear a cymbal and a hi-hat'
      glue = 'I go crazy when I hear a cymbal and a hi-hat'
      olg  = OneLetterGluer.new
      olg.call(Wrap[text, width: 42]).must_equal Wrap[glue, width: 42]
    end

    it 'glues subsequent one-letter words' do
      text = 'one-letter words in English: a, I & o'
      glue = 'one-letter words in English: a, I & o'
      olg  = OneLetterGluer.new
      olg.call(Wrap[text, width: 42]).must_equal Wrap[glue, width: 42]
    end

    it 'passes the fixed text to the next layer and returns its outcome' do
      final = fake :wrap
      layer = fake :layer
      mock(layer).call(Wrap['I O U', width: 69]) { final }
      OneLetterGluer.new(layer).call(Wrap['I O U', width: 69]).must_equal final
    end
  end
end end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lovely_rufus-0.1.2 spec/lovely_rufus/one_letter_gluer_spec.rb
lovely_rufus-0.1.1 spec/lovely_rufus/one_letter_gluer_spec.rb
lovely_rufus-0.1.0 spec/lovely_rufus/one_letter_gluer_spec.rb