Sha256: 0e6496f941aa8a0a8ae658f04357cae1a3d12aed978ca14ed523fbe71eae4d3e

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

require 'helper'
require 'nokogiri'
require 'nokogiri/xml/range/refinement'
require 'nokogiri/xml/replacable'

class TestNokogiriXMLReplacable < Test::Unit::TestCase
  def setup
    @doc = Nokogiri::XML::Document.new
    @text = Nokogiri::XML::Text.new('Hello, world.', @doc)
  end

  def test_substring_data
    assert_equal 'Hello, world.', @text.substring_data(0, 9999)
    assert_equal 'world', @text.substring_data(7, 5)
  end

  def test_replace_data
    @text.replace_data 7, 5, 'Nokogiri'
    assert_equal 'Hello, Nokogiri.', @text.content
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nokogiri-xml-range-0.1.0 test/test_nokogiri-xml-replacable.rb