Sha256: 1ccba333baf9533439f1073996ee4c9a4c03dd926f90101bd5e00b5a90000ef1
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# coding: utf-8 require 'spec_helper' RSpec.describe Verse::Alignment, '.right' do it "aligns line to left" do text = "the madness of men" alignment = Verse::Alignment.new(text) expect(alignment.right(22)).to eq(" the madness of men") end it "aligns multiline text to left" do text = "for there is no folly of the beast\n of the earth which\n is not infinitely\n outdone by the madness of men" alignment = Verse::Alignment.new(text) expect(alignment.right(40)).to eq([ " for there is no folly of the beast\n", " of the earth which\n", " is not infinitely\n", " outdone by the madness of men" ].join) end it "centers multiline text with fill of '*'" do text = "for there is no folly of the beast\n of the earth which\n is not infinitely\n outdone by the madness of men" alignment = Verse::Alignment.new(text, fill: '*') expect(alignment.right(40)).to eq([ "******for there is no folly of the beast\n", "**********************of the earth which\n", "***********************is not infinitely\n", "***********outdone by the madness of men" ].join) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
verse-0.1.1 | spec/unit/alignment/right_spec.rb |
verse-0.1.0 | spec/unit/alignment/right_spec.rb |