Sha256: 3a5142c311cbb2d7dcbd9ea64e454d7943ec6d2cd3cfcd6ae2f57357f070a8e1

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require 'spec_helper'
require 'nokogiri/ext/equality'

describe "nokogiri/ext/equality" 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 test if two elements are equal" do
    elem1 = @doc.at('b')
    elem2 = @edited_doc.at('b')

    expect(elem1).to eq(elem2)
  end

  it "should be able to test if two elements are not equal" do
    elem1 = @doc.at('p').children.last
    elem2 = @edited_doc.at('b')

    expect(elem1).not_to eq(elem2)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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