1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/library/rexml/element/delete_namespace_spec.rb

29 lines
751 B
Ruby
Raw Normal View History

require_relative '../../../spec_helper'
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'
2020-01-11 18:14:26 -05:00
describe "REXML::Element#delete_namespace" do
2020-01-11 18:14:26 -05:00
before :each do
@doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
end
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
2020-01-11 18:14:26 -05:00
it "returns the element" do
@doc.root.delete_namespace.should == @doc.root
end
end
end