Sha256: 0b780bcdec1668dde1f1dc8f1ee73c7d557d93794eea4631cb92239adf31ca8a

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

require 'spec_helper'
require 'nokogiri/ext/traverse_text'

describe "nokogiri/ext/traverse_text" do
  before(:all) do
    @doc = Nokogiri::HTML(%{<html><head><title>test</title></head><body><p><b>This is a test</b> html <i>page</i>.</p></body></html>})

    @edited_doc = Nokogiri::HTML(%{<html><head><title>test</title></head><body><p><b>This is a test</b> html page.</p></body></html>})
  end

  it "should be able to traverse over every text node" do
    text = []

    @doc.traverse_text { |node| text << node.content }

    expect(text).to eq(['test', 'This is a test', ' html ', 'page', '.'])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nokogiri-ext-0.1.1 spec/traverse_text_spec.rb
nokogiri-ext-0.1.0 spec/traverse_text_spec.rb