Sha256: e1702d344355b6c8a4de29aecf1baad753f07ad1f2b0038b456b69b876d7d679

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

require_relative '../../test_helper'
require_relative '../../../lib/lovely_rufus/layers/hangout_wrapper'
require_relative '../../../lib/lovely_rufus/wrap'

module LovelyRufus
  module Layers
    describe HangoutWrapper do
      describe '#call' do
        it 'removes hangouts from the text' do
          text = <<-end.dedent
            I go crazy when I hear a cymbal and
            a hi-hat with a souped-up tempo
          end
          wrap = <<-end.dedent
            I go crazy when I hear a cymbal
            and a hi-hat with a souped-up tempo
          end
          hw = HangoutWrapper.new
          _(hw.call(Wrap[text, width: 35])).must_equal Wrap[wrap, width: 35]
        end

        it 'passes the fixed text to the next layer and returns its outcome' do
          final = fake(:wrap)
          layer = fake(:layer)
          mock(layer).call(any(Wrap)) { final }
          wrapped = HangoutWrapper.new(layer).call(Wrap["I O\nU", width: 4])
          _(wrapped).must_equal final
        end

        it 'doesn’t let the last line to hang out' do
          text = <<-end.dedent
            Just found out the Finnish term for grammar Nazi is pilkunnussija.
            Direct translation: comma fucker. You’re welcome.
          end
          _(HangoutWrapper.new.call(Wrap[text, width: 76]).text).must_equal text
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lovely_rufus-1.0.0 test/lovely_rufus/layers/hangout_wrapper_test.rb
lovely_rufus-0.3.2 test/lovely_rufus/layers/hangout_wrapper_test.rb