mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1d15d5f080
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
35 lines
1.2 KiB
Ruby
35 lines
1.2 KiB
Ruby
require 'rexml/document'
|
|
require 'rexml/formatters/transitive'
|
|
require File.expand_path('../../../../spec_helper', __FILE__)
|
|
|
|
# Maybe this can be cleaned
|
|
describe "REXML::Document#write" do
|
|
before :each do
|
|
@d = REXML::Document.new
|
|
city = REXML::Element.new "Springfield"
|
|
street = REXML::Element.new "EvergreenTerrace"
|
|
address = REXML::Element.new "House742"
|
|
@d << city << street << address
|
|
@str = ""
|
|
end
|
|
|
|
it "returns document source as string" do
|
|
@d.write(@str)
|
|
@str.should == "<Springfield><EvergreenTerrace><House742/></EvergreenTerrace></Springfield>"
|
|
end
|
|
|
|
it "returns document indented" do
|
|
@d.write(@str, 2)
|
|
@str.should =~ /\s*<Springfield>\s*<EvergreenTerrace>\s*<House742\/>\s*<\/EvergreenTerrace>\s*<\/Springfield>/
|
|
end
|
|
|
|
it "returns document with transitive support" do
|
|
@d.write(@str, 2, true)
|
|
@str.should =~ /\s*<Springfield\s*><EvergreenTerrace\s*><House742\s*\/><\/EvergreenTerrace\s*><\/Springfield\s*>/
|
|
end
|
|
|
|
it "returns document with support for IE" do
|
|
@d.write(@str, -1, false, true)
|
|
@str.should == "<Springfield><EvergreenTerrace><House742 /></EvergreenTerrace></Springfield>"
|
|
end
|
|
end
|