Sha256: 71fc9f91a89cbae3b9a8c61b18f9034e811879901c183db0c4ab5228e2c8a538

Contents?: true

Size: 615 Bytes

Versions: 5

Compression:

Stored size: 615 Bytes

Contents

require 'rexml/document'

describe "REXML::Element#prefixes" do
  before :each do
    doc = REXML::Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
    @elem = doc.elements["//c"]
  end

  it "returns an array of the prefixes of the namespaces" do
    @elem.prefixes.should == ["y", "z"]
  end

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

  it "returns an empty array if no namespace was defined" do
    doc = REXML::Document.new "<root><something/></root>"
    root = doc.elements["//root"]
    root.prefixes.should == []
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysl-rexml-2.0.4 spec/element/prefixes_spec.rb
rubysl-rexml-2.0.3 spec/element/prefixes_spec.rb
rubysl-rexml-1.0.0 spec/element/prefixes_spec.rb
rubysl-rexml-2.0.2 spec/element/prefixes_spec.rb
rubysl-rexml-2.0.1 spec/element/prefixes_spec.rb