onebox 1.4.5 → 1.4.7
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/lib/onebox/engine/twitter_status_onebox.rb +8 -81
- data/lib/onebox/engine/whitelisted_generic_onebox.rb +2 -0
- data/lib/onebox/version.rb +1 -1
- data/spec/fixtures/twitterstatus.response +12 -3005
- data/spec/lib/onebox/engine/twitter_status_onebox_spec.rb +12 -84
- metadata +3 -3
|
@@ -2,102 +2,30 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe Onebox::Engine::TwitterStatusOnebox do
|
|
4
4
|
before(:all) do
|
|
5
|
-
@link = "https://twitter.com/
|
|
5
|
+
@link = "https://twitter.com/discourse/status/504354595733504000"
|
|
6
|
+
@uri = "https://api.twitter.com/1/statuses/oembed.json?id=504354595733504000"
|
|
7
|
+
fake(@uri, response(described_class.onebox_name))
|
|
8
|
+
onebox = described_class.new(@link)
|
|
9
|
+
@html = onebox.to_html
|
|
6
10
|
end
|
|
11
|
+
let(:html) { @html }
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
describe "#to_html" do
|
|
9
14
|
it "includes tweet" do
|
|
10
|
-
expect(html).to include("
|
|
15
|
+
expect(html).to include("Introducing Discourse 1.0!")
|
|
11
16
|
end
|
|
12
17
|
|
|
13
18
|
it "includes timestamp" do
|
|
14
19
|
pending
|
|
15
|
-
expect(html).to include("
|
|
20
|
+
expect(html).to include("August 26, 2014")
|
|
16
21
|
end
|
|
17
22
|
|
|
18
23
|
it "includes username" do
|
|
19
|
-
expect(html).to include("
|
|
24
|
+
expect(html).to include("discourse")
|
|
20
25
|
end
|
|
21
26
|
|
|
22
|
-
it "includes
|
|
23
|
-
expect(html).to include("
|
|
27
|
+
it "includes link" do
|
|
28
|
+
expect(html).to include("https://twitter.com/discourse/statuses/504354595733504000")
|
|
24
29
|
end
|
|
25
|
-
|
|
26
|
-
it "includes tweet favorite count" do
|
|
27
|
-
pending
|
|
28
|
-
expect(html).to include("")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "includes retweet count" do
|
|
32
|
-
pending
|
|
33
|
-
expect(html).to include("")
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context "with html" do
|
|
38
|
-
include_context "engines"
|
|
39
|
-
it_behaves_like "an engine"
|
|
40
|
-
it_behaves_like "#to_html"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "with twitter client" do
|
|
44
|
-
before(:each) do
|
|
45
|
-
@twitter_client = double("TwitterClient")
|
|
46
|
-
@twitter_client.stub("status") do
|
|
47
|
-
{
|
|
48
|
-
created_at: "Fri Aug 02 01:59:30 +0000 2013",
|
|
49
|
-
id: 363_116_819_147_538_433,
|
|
50
|
-
id_str: "363116819147538433",
|
|
51
|
-
text:
|
|
52
|
-
"I'm a sucker for pledges. @Peers Pledge #sharingeconomy http://t.co/T4Sc47KAzh",
|
|
53
|
-
source:
|
|
54
|
-
"<a href=\"http://twitter.com/tweetbutton\" rel=\"nofollow\">Tweet Button</a>",
|
|
55
|
-
user:
|
|
56
|
-
{ id: 1_087_064_150,
|
|
57
|
-
id_str: "1087064150",
|
|
58
|
-
name: "Vyki Englert",
|
|
59
|
-
screen_name: "vyki_e",
|
|
60
|
-
location: "Los Angeles, CA",
|
|
61
|
-
description: "I am woman, hear me #RoR.",
|
|
62
|
-
url: "http://t.co/umZG76wmv2",
|
|
63
|
-
protected: false,
|
|
64
|
-
followers_count: 249,
|
|
65
|
-
friends_count: 907,
|
|
66
|
-
listed_count: 6,
|
|
67
|
-
created_at: "Sun Jan 13 19:53:00 +0000 2013",
|
|
68
|
-
favourites_count: 506,
|
|
69
|
-
statuses_count: 926,
|
|
70
|
-
lang: "en",
|
|
71
|
-
contributors_enabled: false,
|
|
72
|
-
is_translator: false,
|
|
73
|
-
profile_image_url:
|
|
74
|
-
"http://pbs.twimg.com/profile_images/3518892092/39b969d32a10b2437563e246708c8f9d_normal.jpeg",
|
|
75
|
-
profile_image_url_https:
|
|
76
|
-
"https://pbs.twimg.com/profile_images/3518892092/39b969d32a10b2437563e246708c8f9d_normal.jpeg",
|
|
77
|
-
following: true,
|
|
78
|
-
follow_request_sent: false,
|
|
79
|
-
notifications: nil },
|
|
80
|
-
geo: nil,
|
|
81
|
-
coordinates: nil,
|
|
82
|
-
place: nil,
|
|
83
|
-
contributors: nil,
|
|
84
|
-
retweet_count: 0,
|
|
85
|
-
favorite_count: 0,
|
|
86
|
-
favorited: false,
|
|
87
|
-
retweeted: false,
|
|
88
|
-
possibly_sensitive: false,
|
|
89
|
-
lang: "en"
|
|
90
|
-
}
|
|
91
|
-
end
|
|
92
|
-
Onebox.options = { twitter_client: @twitter_client }
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
after(:each) do
|
|
96
|
-
Onebox.options = { twitter_client: nil }
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
include_context "engines"
|
|
100
|
-
it_behaves_like "an engine"
|
|
101
|
-
it_behaves_like "#to_html"
|
|
102
30
|
end
|
|
103
31
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onebox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joanna Zeta
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2014-08-
|
|
13
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: multi_json
|
|
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
342
342
|
version: '0'
|
|
343
343
|
requirements: []
|
|
344
344
|
rubyforge_project:
|
|
345
|
-
rubygems_version: 2.
|
|
345
|
+
rubygems_version: 2.1.11
|
|
346
346
|
signing_key:
|
|
347
347
|
specification_version: 4
|
|
348
348
|
summary: A gem for turning URLs into previews.
|