mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Fix word_wrap not to break at max line length
...but *after* the max line length.
This commit is contained in:
parent
8e68d99217
commit
a0b6cb2581
2 changed files with 12 additions and 1 deletions
|
@ -165,7 +165,7 @@ module Shoulda
|
|||
end
|
||||
|
||||
def determine_where_to_break_line(line)
|
||||
index = TERMINAL_WIDTH - 1
|
||||
index = TERMINAL_WIDTH
|
||||
|
||||
while line[index] !~ /\s/
|
||||
index -= 1
|
||||
|
|
|
@ -35,6 +35,17 @@ luscious, ipsum sit amet efficitur feugiat
|
|||
MESSAGE
|
||||
end
|
||||
|
||||
it "does not break at the maximum line length, but afterward" do
|
||||
wrapped_message = described_class.word_wrap(<<-MESSAGE.rstrip)
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luscius, ipsum sit amet efficitur feugiat
|
||||
MESSAGE
|
||||
|
||||
expect(wrapped_message).to eq(<<-MESSAGE.rstrip)
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean luscius,
|
||||
ipsum sit amet efficitur feugiat
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
it "re-wraps entire paragraphs" do
|
||||
wrapped_message = described_class.word_wrap(<<-MESSAGE)
|
||||
Lorem ipsum dolor sit amet,
|
||||
|
|
Loading…
Reference in a new issue