Sha256: 465f9ce9812035976bff826489713517674b00aa0c54ccc402345ee7d9c277b4

Contents?: true

Size: 1010 Bytes

Versions: 3

Compression:

Stored size: 1010 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 Collection" 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

3 entries across 3 versions & 1 rubygems

Version Path
microformats-4.0.7 spec/lib/microformats_spec.rb
microformats-4.0.6 spec/lib/microformats_spec.rb
microformats-4.0.5 spec/lib/microformats_spec.rb