HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-3.0.2/spec/ruby/library/rexml/element/delete_namespace_spec.rb
require_relative '../../../spec_helper'

ruby_version_is ''...'3.0' do
  require 'rexml/document'

  describe "REXML::Element#delete_namespace" do

    before :each do
      @doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
    end

    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

    it "returns the element" do
      @doc.root.delete_namespace.should == @doc.root
    end
  end
end