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/attributes/prefixes_spec.rb
require_relative '../../../spec_helper'

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

  describe "REXML::Attributes#prefixes" do
    before :each do
      @e = REXML::Element.new("root")
      a1 = REXML::Attribute.new("xmlns:a", "bar")
      a2 = REXML::Attribute.new("xmlns:b", "bla")
      a3 = REXML::Attribute.new("xmlns:c", "baz")
      @e.attributes << a1
      @e.attributes << a2
      @e.attributes << a3

      @e.attributes << REXML::Attribute.new("xmlns", "foo")
    end

    it "returns an array with the prefixes of each attribute" do
      @e.attributes.prefixes.sort.should == ["a", "b", "c"]
    end

    it "does not include the default namespace" do
      @e.attributes.prefixes.include?("xmlns").should == false
    end
  end
end