Sha256: e9c359ddadb43fb5e946696f02b491b8325379c68d9572b21fc220bc0601c473

Contents?: true

Size: 818 Bytes

Versions: 7

Compression:

Stored size: 818 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Sniffles::HTML" do
  before(:all) do
    class Klass
      include Sniffles::HTML
      attr_accessor :doc
    end
    
    @klass = Klass.new
    @klass.parse "<html><head><title>Title!</title></head><body><h1>Body!</h1></body></html>"
  end
  
  describe "#parse" do
    it "should take HTML and return a parsed Nokogiri document" do
      @klass.doc.should be_kind_of(Nokogiri::HTML::Document)
    end
  end
  
  describe "#text_match?" do
    context "does match" do
      it "should be true" do
        @klass.text_match?("//title", "Title!").should be true
      end
    end
    
    context "does not match" do
      it "should be false" do
        @klass.text_match?("//title", "Body!").should be false
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sniffles-0.1.5 spec/sniffles/html_spec.rb
sniffles-0.1.4 spec/sniffles/html_spec.rb
sniffles-0.1.3 spec/sniffles/html_spec.rb
sniffles-0.1.2 spec/sniffles/html_spec.rb
sniffles-0.1.1 spec/sniffles/html_spec.rb
sniffles-0.1.0.1 spec/sniffles/html_spec.rb
sniffles-0.1.0 spec/sniffles/html_spec.rb