hentry_consumer 0.3.0 → 0.3.1
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.
@@ -21,14 +21,14 @@ module HentryConsumer
|
|
21
21
|
:properties => {
|
22
22
|
:name => self.name,
|
23
23
|
:categories => self.categories,
|
24
|
-
:author => self.author,
|
24
|
+
:author => self.author.map(&:to_json),
|
25
25
|
:content => self.content,
|
26
26
|
:bookmark => self.bookmark,
|
27
27
|
:published_at => self.published_at,
|
28
28
|
:summary => self.summary
|
29
29
|
}
|
30
30
|
}]
|
31
|
-
}
|
31
|
+
}
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -19,12 +19,12 @@ module HentryConsumer
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_json(*a)
|
22
|
-
{:items =>
|
22
|
+
json = {:items =>
|
23
23
|
[{
|
24
24
|
:type => ["h-feed"],
|
25
|
-
:properties => {:entries => self.entries}
|
25
|
+
:properties => {:entries => self.entries.map(&:to_json)}
|
26
26
|
}]
|
27
|
-
}
|
27
|
+
}
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -59,17 +59,17 @@ describe HentryConsumer::HEntry do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
describe "json" do
|
62
|
-
let(:json) {
|
62
|
+
let(:json) { entry.to_json }
|
63
63
|
|
64
|
-
it { json[
|
65
|
-
it { json[
|
66
|
-
it { json[
|
67
|
-
it { json[
|
68
|
-
it { json[
|
69
|
-
it { json[
|
70
|
-
it { json[
|
71
|
-
it { json[
|
72
|
-
it { json[
|
64
|
+
it { json[:items].should be_an_instance_of Array }
|
65
|
+
it { json[:items].first[:type].should include 'h-entry'}
|
66
|
+
it { json[:items].first[:properties][:name].should eq ['Senior Cat Living']}
|
67
|
+
it { json[:items].first[:properties][:content].first.should match /Locations/ }
|
68
|
+
it { json[:items].first[:properties][:author].should be_an_instance_of Array }
|
69
|
+
it { json[:items].first[:properties][:author].first[:items].first[:type].should include "h-card" }
|
70
|
+
it { json[:items].first[:properties][:bookmark].should eq "http://g5.com/feed/entries/2012-08-26-20-09-0700" }
|
71
|
+
it { json[:items].first[:properties][:published_at].should eq ["2012-08-26 20:09-0700"] }
|
72
|
+
it { json[:items].first[:properties][:summary].should be_an_instance_of Array }
|
73
73
|
end
|
74
74
|
|
75
75
|
end
|
@@ -4,12 +4,12 @@ describe HentryConsumer::HFeed do
|
|
4
4
|
let(:feed) { HentryConsumer.parse(File.open("spec/support/example.html")) }
|
5
5
|
|
6
6
|
describe "to json" do
|
7
|
-
let(:json) {
|
7
|
+
let(:json) { feed.to_json }
|
8
8
|
|
9
|
-
it { json[
|
10
|
-
it { json[
|
11
|
-
it { json[
|
12
|
-
it { json[
|
9
|
+
it { json[:items].first[:type].should include 'h-feed'}
|
10
|
+
it { json[:items].first[:properties][:entries].should be_an_instance_of Array }
|
11
|
+
it { json[:items].first[:properties][:entries].first[:items].should be_an_instance_of Array }
|
12
|
+
it { json[:items].first[:properties][:entries].first[:items].first[:type].should include "h-entry" }
|
13
13
|
|
14
14
|
end
|
15
15
|
# <article class=\"h-entry\"><h1 class=\"p-name\">Senior Cat Living</h1>
|