Sha256: d27c8f5df33c22c5e632b6c56e5c4381e74e0142d0bbc9d2ef7a14ded85f581b

Contents?: true

Size: 1004 Bytes

Versions: 7

Compression:

Stored size: 1004 Bytes

Contents

require "spec_helper"
require "microformats2"

describe Microformats2 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 a collection" do
      Microformats2.parse(@html).should be_kind_of Microformats2::Collection
    end
  end

  describe "::read_html" do
    it "can be a string of html" do
      Microformats2.read_html(@html).should include @html
    end
    it "can be a file path to html" do
      html = "spec/support/lib/microformats2/simple.html"
      Microformats2.read_html(html).should 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"
      Microformats2.read_html(html).should include "google"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microformats2-2.9.0 spec/lib/microformats2_spec.rb
microformats2-2.1.0 spec/lib/microformats2_spec.rb
microformats2-2.0.3 spec/lib/microformats2_spec.rb
microformats2-2.0.2 spec/lib/microformats2_spec.rb
microformats2-2.0.1 spec/lib/microformats2_spec.rb
microformats2-2.0.0 spec/lib/microformats2_spec.rb
microformats2-2.0.0.pre5 spec/lib/microformats2_spec.rb