Sha256: 1d2744eb9300f6a3a63f86fd8ac87b169ed44121d5ddcdd1369ffef937bcf5f6

Contents?: true

Size: 1.1 KB

Versions: 49

Compression:

Stored size: 1.1 KB

Contents

require 'rexml/document'
require File.expand_path('../../../../spec_helper', __FILE__)

describe :rexml_elements_to_a, :shared => true do
  before :each do
    @e = REXML::Element.new "root"
    @first = REXML::Element.new("FirstChild")
    @second = REXML::Element.new("SecondChild")
    @e << @first
    @e << @second
  end

  it "returns elements that match xpath" do
    @e.elements.send(@method, "FirstChild").first.should == @first
  end

  # According to the docs REXML::Element#get_elements is an alias for
  # REXML::Elements.to_a. Implementation wise there's a difference, get_elements
  # always needs the first param (even if it's nil).
  # A patch was submitted:
  # http://rubyforge.org/tracker/index.php?func=detail&aid=19354&group_id=426&atid=1698
  ruby_bug "#", "1.8.6.114" do
    it "returns all childs if xpath is nil" do
      @e.elements.send(@method).should == [@first, @second]
    end
  end

end

describe "REXML::REXML::Elements#to_a" do
  it_behaves_like :rexml_elements_to_a, :to_a
end

describe "REXML::REXML::Element#get_elements" do
  it_behaves_like :rexml_elements_to_a, :get_elements
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-7.5.1 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-7.4.1 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-7.1.17 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-6.2.0 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-6.0.11 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.18 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.17 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.15 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.2 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-5.5.0 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-3.3.5 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb
rhodes-3.4.2 spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb