summaryrefslogtreecommitdiff
path: root/spec/ruby/library/rexml/element/get_text_spec.rb
blob: 9ae343e097766c82eb30621824789e18b86e6144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'rexml/document'
require File.expand_path('../../../../spec_helper', __FILE__)

describe "REXML::Element#get_text" do
  before :each do
    @doc = REXML::Document.new "<p>some text<b>this is bold!</b> more text</p>"
  end

  it "returns the first text child node" do
    @doc.root.get_text.value.should == "some text"
    @doc.root.get_text.should be_kind_of(REXML::Text)
  end

  it "returns text from an element matching path" do
    @doc.root.get_text("b").value.should == "this is bold!"
    @doc.root.get_text("b").should be_kind_of(REXML::Text)
  end
end