Sha256: 31fc4af21f313977958328ed74e6088851ec852c541bcdc94345d958a41cd47e

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

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

module LovelyRufus
  describe Wrap do
    describe '.[]' do
      it 'creates a Wrap with the given text and target width' do
        Wrap['Ice Ice Baby', width: 7].text.must_equal 'Ice Ice Baby'
        Wrap['Ice Ice Baby', width: 7].width.must_equal 7
      end

      it 'defaults to empty text and width of 72' do
        Wrap[].text.must_equal ''
        Wrap[].width.must_equal 72
      end
    end

    describe '#lines' do
      it 'accesses the lines of the text' do
        Wrap["all right: stop,\ncollaborate and listen\n"].lines.must_equal [
          "all right: stop,\n", "collaborate and listen\n"
        ]
      end
    end

    describe '#text' do
      it 'accesses the text of the Wrap' do
        Wrap['Ice Ice Baby', width: 7].text.must_equal 'Ice Ice Baby'
      end
    end

    describe '#width' do
      it 'accesses the target width of the Wrap' do
        Wrap['Ice Ice Baby', width: 7].width.must_equal 7
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lovely_rufus-0.3.1 test/lovely_rufus/wrap_test.rb
lovely_rufus-0.3.0 test/lovely_rufus/wrap_test.rb