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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0d43fe15ed1fa8915d12f622aa25481860f287b
4
- data.tar.gz: 14939808b046effdc74e119067608cb474b92a05
3
+ metadata.gz: 09e1026bba3015274f30b068a935e90dd8297c03
4
+ data.tar.gz: cd4157d671e118ed122dce2e54ea39bc5d404e94
5
5
  SHA512:
6
- metadata.gz: fc3d8ec9d776c3846211b654f3289928fe5b3a44f8df35052e9ef3dbf57a9f0d7dbb5d288ac7dabb7c7282a3fb952a6b43db972ac0af1bec05f1fc3eebda288c
7
- data.tar.gz: cded134d21fa25d5890863a53b3c6ffbe7e2b460d20a8feb6d06807fd39eddc1885d3b861fdc9ab1915937ee9b5965bb02d969e737243ab3f4f360f1c4139aa8
6
+ metadata.gz: 7dc34d2e95dbe926398b609fcf621ecf9f9ed0ae70a1156b021d52e0a7ef24b77730944005a26a800ebc5e70a34dfdb4990c6a826a252056ce0a4b5dc603daab
7
+ data.tar.gz: e8f428c62928beb75842215194a7d687ec03e476507d49ae8e6fb55fc787cb873876a864de322106d171b3e446a285a2148f4da3f87106a2fa236154fe290147
data/README.md CHANGED
@@ -34,9 +34,9 @@ Not Implemented:
34
34
 
35
35
  ## Current Version
36
36
 
37
- 4.0.4
37
+ 4.0.5
38
38
 
39
- ![Version 4.0.3](https://img.shields.io/badge/VERSION-4.0.4-green.svg)
39
+ ![Version 4.0.5](https://img.shields.io/badge/VERSION-4.0.5-green.svg)
40
40
 
41
41
 
42
42
  ## Requirements
@@ -42,13 +42,13 @@ module Microformats
42
42
  end
43
43
 
44
44
  def read_html(html, headers:{})
45
- html.strip!
46
- open(html, headers) do |response|
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 = html
51
+ @base = stripped_html
52
52
  end
53
53
  @http_body
54
54
  rescue Errno::ENOENT, Errno::ENAMETOOLONG => e
@@ -1,3 +1,3 @@
1
1
  module Microformats
2
- VERSION = "4.0.4"
2
+ VERSION = "4.0.5"
3
3
  end
@@ -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|
@@ -9,7 +9,7 @@ describe Microformats do
9
9
  end
10
10
 
11
11
  describe "::parse" do
12
- it "returns ParserResult" do
12
+ it "returns Collection" do
13
13
  expect(Microformats.parse(@html)).to be_kind_of Microformats::Collection
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microformats
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Becker