2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-09-15 15:54:31 -04:00
|
|
|
ruby_version_is ''...'3.0' do
|
2020-01-11 18:14:26 -05:00
|
|
|
require 'rexml/document'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
describe "REXML::Element#delete_namespace" do
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
before :each do
|
|
|
|
@doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
it "deletes a namespace from the element" do
|
|
|
|
@doc.root.delete_namespace 'foo'
|
|
|
|
@doc.root.namespace("foo").should be_nil
|
|
|
|
@doc.root.to_s.should == "<a xmlns='twiddle'/>"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "deletes default namespace when called with no args" do
|
|
|
|
@doc.root.delete_namespace
|
|
|
|
@doc.root.namespace.should be_empty
|
|
|
|
@doc.root.to_s.should == "<a xmlns:foo='bar'/>"
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2020-01-11 18:14:26 -05:00
|
|
|
it "returns the element" do
|
|
|
|
@doc.root.delete_namespace.should == @doc.root
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|