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-3.3.4 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.3 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.3.beta.4 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.3.beta.3 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.3.beta.2 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.3.beta.1 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.7 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.6 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.5 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.4 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.3 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.2 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.2.beta.1 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.1 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.0 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.0.beta.3 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.0.beta.2 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.3.0.beta.1 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb
rhodes-3.2.3 spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb