Sha256: 04fe780c97366fc70fb1d94d13b84a838ec0557bf7dfaa82d3cb67bed27dfe08

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require_relative 'test_helper'
require 'splunk-sdk-ruby'

include Splunk

class TestXMLShim < Test::Unit::TestCase
  def test_no_matches_with_rexml
    Splunk::require_xml_library(:rexml)
    assert_nil(Splunk::text_at_xpath("//msg", "<html>Hi</html>"))
  end

  def test_no_matches_with_nokogiri
    Splunk::require_xml_library(:nokogiri)
    assert_nil(Splunk::text_at_xpath("//msg", "<html>Hi</html>"))
  end

  def test_matches_with_nokogiri
    Splunk::require_xml_library(:nokogiri)
    m = Splunk::text_at_xpath("//msg", "<response><msg>Boris &amp; Natasha</msg></response>")
    assert_equal("Boris & Natasha", m)
  end

  def test_matches_with_rexml
    Splunk::require_xml_library(:rexml)
    m = Splunk::text_at_xpath("//msg", "<response><msg>Boris &amp; Natasha</msg></response>")
    assert_equal("Boris & Natasha", m)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
splunk-sdk-ruby-0.1.0 test/test_xml_shim.rb