Sha256: 4bebfc6d65a21ac0b30d5e6ab40ca13743f4df3727520a1a70f28796c6be96eb
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' require 'ronin/web/extensions/nokogiri' require 'nokogiri' describe Nokogiri::HTML 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') elem1.should == 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') elem1.should_not == elem2 end it "should be able to traverse over every text node" do text = [] @doc.traverse_text { |node| text << node.content } text.should == ['test', 'This is a test', ' html ', 'page', '.'] end it "should provide a count of all sub-children" do @doc.total_children.should == 12 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ronin-web-0.3.0.rc1 | spec/web/extensions/nokogiri_spec.rb |
ronin-web-0.3.0.pre2 | spec/web/extensions/nokogiri_spec.rb |
ronin-web-0.3.0.pre1 | spec/web/extensions/nokogiri_spec.rb |