Sha256: 0ef34f6a04b7448ba200cfa563fbc2e17b909f9007d63c3b436111338b9d85ad

Contents?: true

Size: 1012 Bytes

Versions: 5

Compression:

Stored size: 1012 Bytes

Contents

require "spec_helper"
require "microformats"

describe Microformats do
  before do
    @html = <<-HTML.strip
      <div class="h-card"><p class="p-name">Jessica Lynn Suttles</p></div>
    HTML
  end

  describe "::parse" do
    it "returns ParserResult" do
      expect(Microformats.parse(@html)).to be_kind_of Microformats::Collection
    end
  end

  describe "::read_html" do
    it "can be a string of html" do
      expect(Microformats.read_html(@html)).to include @html
    end
    it "can be a file path to html" do
      html = "spec/support/lib/microformats/simple.html"
      expect(Microformats.read_html(html)).to include "<div class=\"h-card\">"
    end
    it "can be a url to html" do
      stub_request(:get, "http://google.com/").
               with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
               to_return(:status => 200, :body => "google", :headers => {})
      html = "http://google.com"
      expect(Microformats.read_html(html)).to include "google"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
microformats-4.0.4 spec/lib/microformats_spec.rb
microformats-4.0.3 spec/lib/microformats_spec.rb
microformats-4.0.2 spec/lib/microformats_spec.rb
microformats-4.0.1 spec/lib/microformats_spec.rb
microformats-4.0.0 spec/lib/microformats_spec.rb