2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../../spec_helper'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
ruby_version_is ''...'2.8' do
|
|
|
|
require 'rexml/document'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
describe "REXML::Text#wrap" do
|
|
|
|
before :each do
|
|
|
|
@t = REXML::Text.new("abc def")
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
it "wraps the text at width" do
|
|
|
|
@t.wrap("abc def", 3, false).should == "abc\ndef"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns the string if width is greater than the size of the string" do
|
|
|
|
@t.wrap("abc def", 10, false).should == "abc def"
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
it "takes a newline at the beginning option as the third parameter" do
|
|
|
|
@t.wrap("abc def", 3, true).should == "\nabc\ndef"
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
end
|
|
|
|
end
|