Sha256: 6416576499e928cba2d034fe0b82b1bccd57d1f7f7a08864f1d0e7752dad429e

Contents?: true

Size: 884 Bytes

Versions: 49

Compression:

Stored size: 884 Bytes

Contents

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

describe "REXML::Element#each_element_with_text" do
  before :each do
    @document = REXML::Element.new("people")

    @joe = REXML::Element.new("Person")
    @joe.text = "Joe"
    @fred = REXML::Element.new("Person")
    @fred.text = "Fred"
    @another = REXML::Element.new("AnotherPerson")
    @another.text = "Fred"
    @document.root << @joe
    @document.root << @fred
    @document.root << @another
    @childs = []
  end

  it "returns childs with text" do
    @document.each_element_with_text("Joe"){|c| c.should == @joe}
  end

  it "takes max as second argument" do
    @document.each_element_with_text("Fred", 1){ |c| c.should == @fred}
  end

  it "takes XPath filter as third argument" do
    @document.each_element_with_text("Fred", 0, "Person"){ |c| c.should == @fred}
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

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