microformats 4.0.4 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/microformats/parser.rb +3 -3
- data/lib/microformats/version.rb +1 -1
- data/spec/lib/microformats/parser_spec.rb +30 -0
- data/spec/lib/microformats_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09e1026bba3015274f30b068a935e90dd8297c03
|
4
|
+
data.tar.gz: cd4157d671e118ed122dce2e54ea39bc5d404e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc34d2e95dbe926398b609fcf621ecf9f9ed0ae70a1156b021d52e0a7ef24b77730944005a26a800ebc5e70a34dfdb4990c6a826a252056ce0a4b5dc603daab
|
7
|
+
data.tar.gz: e8f428c62928beb75842215194a7d687ec03e476507d49ae8e6fb55fc787cb873876a864de322106d171b3e446a285a2148f4da3f87106a2fa236154fe290147
|
data/README.md
CHANGED
data/lib/microformats/parser.rb
CHANGED
@@ -42,13 +42,13 @@ module Microformats
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def read_html(html, headers:{})
|
45
|
-
html.strip
|
46
|
-
open(
|
45
|
+
stripped_html = html.strip
|
46
|
+
open(stripped_html, headers) do |response|
|
47
47
|
@http_headers = response.meta if response.respond_to?(:meta)
|
48
48
|
@http_body = response.read
|
49
49
|
end
|
50
50
|
if @base.nil?
|
51
|
-
@base =
|
51
|
+
@base = stripped_html
|
52
52
|
end
|
53
53
|
@http_body
|
54
54
|
rescue Errno::ENOENT, Errno::ENAMETOOLONG => e
|
data/lib/microformats/version.rb
CHANGED
@@ -55,6 +55,36 @@ describe Microformats::Parser do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
describe "#frozen_strings" do
|
59
|
+
|
60
|
+
describe "frozen url" do
|
61
|
+
before do
|
62
|
+
stub_request(:get, "http://www.example.com/").
|
63
|
+
with(:headers => {"Accept"=>"*/*", "User-Agent"=>"Ruby"}).
|
64
|
+
to_return(:status => 200, :body => "abc", :headers => {"Content-Length" => 3})
|
65
|
+
url = "http://www.example.com"
|
66
|
+
url.freeze
|
67
|
+
parser.parse(url)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "saves #http_body" do
|
71
|
+
expect(parser.http_body).to eq("abc")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "frozen html" do
|
76
|
+
before do
|
77
|
+
@html = '<div class="h-card"><p class="p-name">Jessica Lynn Suttles</p></div>'
|
78
|
+
@html.freeze
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns Collection" do
|
82
|
+
expect(Microformats.parse(@html)).to be_kind_of Microformats::Collection
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
58
88
|
describe "edge cases" do
|
59
89
|
cases_dir = "spec/support/lib/edge_cases/"
|
60
90
|
Dir[File.join(cases_dir, "*")].keep_if { |f| f =~ /([.]js$)/ }.each do |json_file|
|