File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ def wrap(length = 80)
1616 strip!
1717 split ( "\n " ) . collect! do |line |
1818 if line . length > length
19- line . gsub! ( /([^\s ]{#{ length } })([^\s $])/ , "\\ 1 \\ 2" )
2019 line . gsub ( /(.{1,#{ length } })(\s +|$)/ , "\\ 1\n " ) . rstrip
2120 else
2221 line
Original file line number Diff line number Diff line change 2020 it "wraps the string to the specified length" do
2121 expect ( subject . wrap 30 ) . to eq "a long line of text that is\n going to be wrapped, fingers\n crossed!"
2222 end
23- end
2423
24+ # GH-79
25+ context "with an uninterrupted string" do
26+ subject { "a long line of text with a nice uninterrupted-string-like-a-url-for-example" }
27+ it "does not break the uninterrupted portion" do
28+ expect ( subject . wrap 30 ) . to eq "a long line of text with a\n nice\n uninterrupted-string-like-a-url-for-example"
29+ end
30+ end
31+ end
2532
2633 describe '#to_underscore' do
2734 subject { "Some String" }
You can’t perform that action at this time.
0 commit comments