hentry_consumer 0.6.0 → 0.7.0

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.
data/README.md CHANGED
@@ -34,7 +34,7 @@ The returned Object structure looks something like this:
34
34
 
35
35
  ## Current Version
36
36
 
37
- 0.6.0
37
+ 0.7.0
38
38
 
39
39
 
40
40
  ## Requirements
@@ -2,8 +2,8 @@ module HentryConsumer
2
2
  class HFeed
3
3
  attr_accessor :html, :entries
4
4
 
5
- def initialize(html)
6
- @html = Nokogiri::HTML(open(html).read)
5
+ def initialize(html, headers={})
6
+ @html = Nokogiri::HTML(open(html, headers).read)
7
7
  @entries = []
8
8
  parse_html
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module HentryConsumer
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -2,6 +2,18 @@ require 'hentry_consumer'
2
2
 
3
3
  describe HentryConsumer::HFeed do
4
4
  let(:feed) { HentryConsumer.parse(File.open("spec/support/example.html")) }
5
+
6
+ describe "caching" do
7
+ it "returns false on 304" do
8
+ HentryConsumer::HFeed.any_instance.stub(:open).
9
+ with("spec/support/example.html", last_modified: Time.parse("Jan 1 2012")).
10
+ and_raise( OpenURI::HTTPError.new("304 Not Modified", nil) )
11
+
12
+ lambda { HentryConsumer::HFeed.new("spec/support/example.html", last_modified: Time.parse("Jan 1 2012")) }.
13
+ should raise_error OpenURI::HTTPError, "304 Not Modified"
14
+ end
15
+ end
16
+
5
17
 
6
18
  describe "#to_json" do
7
19
  let(:json) { JSON.parse(feed.to_json) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hentry_consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-11 00:00:00.000000000 Z
13
+ date: 2012-12-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri