jekyll-twitter-plugin 1.4.0 → 2.0.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +0 -1
- data/README.md +92 -82
- data/jekyll-twitter-plugin.gemspec +5 -6
- data/lib/jekyll-twitter-plugin.rb +141 -121
- data/media/embedded-grid.png +0 -0
- data/media/embedded-moment.png +0 -0
- data/media/embedded-timeline.png +0 -0
- data/media/embedded-tweet.png +0 -0
- data/spec/api_request_spec.rb +82 -0
- data/spec/integration_tests.rb +10 -3
- data/spec/spec_helper.rb +1 -0
- data/spec/support/shared_contexts.rb +5 -4
- data/spec/twitter_tag_spec.rb +117 -112
- metadata +22 -17
- data/spec/oembed_spec.rb +0 -103
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-twitter-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Murray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,18 +42,18 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
-
type: :
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- robmurray17@gmail.com
|
@@ -97,8 +97,12 @@ files:
|
|
97
97
|
- Rakefile
|
98
98
|
- jekyll-twitter-plugin.gemspec
|
99
99
|
- lib/jekyll-twitter-plugin.rb
|
100
|
+
- media/embedded-grid.png
|
101
|
+
- media/embedded-moment.png
|
102
|
+
- media/embedded-timeline.png
|
103
|
+
- media/embedded-tweet.png
|
104
|
+
- spec/api_request_spec.rb
|
100
105
|
- spec/integration_tests.rb
|
101
|
-
- spec/oembed_spec.rb
|
102
106
|
- spec/spec_helper.rb
|
103
107
|
- spec/support/jekyll_template.rb
|
104
108
|
- spec/support/shared_contexts.rb
|
@@ -115,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
119
|
requirements:
|
116
120
|
- - ">="
|
117
121
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
122
|
+
version: 2.0.0
|
119
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
124
|
requirements:
|
121
125
|
- - ">="
|
@@ -126,10 +130,11 @@ rubyforge_project:
|
|
126
130
|
rubygems_version: 2.5.1
|
127
131
|
signing_key:
|
128
132
|
specification_version: 4
|
129
|
-
summary: A Liquid tag plugin for Jekyll that
|
133
|
+
summary: A Liquid tag plugin for Jekyll blogging engine that embeds Tweets, Timelines
|
134
|
+
and more from Twitter API.
|
130
135
|
test_files:
|
136
|
+
- spec/api_request_spec.rb
|
131
137
|
- spec/integration_tests.rb
|
132
|
-
- spec/oembed_spec.rb
|
133
138
|
- spec/spec_helper.rb
|
134
139
|
- spec/support/jekyll_template.rb
|
135
140
|
- spec/support/shared_contexts.rb
|
data/spec/oembed_spec.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe TwitterJekyll::Oembed do
|
3
|
-
let(:api_client) { double("Twitter::REST::Client") }
|
4
|
-
let(:status_response) { double }
|
5
|
-
subject { described_class.new(api_client, params) }
|
6
|
-
|
7
|
-
describe "parsing status id" do
|
8
|
-
let(:params) { ["https://twitter.com/twitter_user/status/12345"] }
|
9
|
-
|
10
|
-
it "parses the status id from the tweet url correctly" do
|
11
|
-
status_response = double
|
12
|
-
allow(Twitter::REST::Client).to receive(:new).and_return(api_client)
|
13
|
-
|
14
|
-
expect(api_client).to receive(:status).with(12_345).and_return(status_response)
|
15
|
-
expect(api_client).to receive(:oembed).with(status_response, {}).and_return("")
|
16
|
-
subject.fetch
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "parsing options" do
|
21
|
-
context "with extra options" do
|
22
|
-
let(:params) { ["https://twitter.com/twitter_user/status/12345", "align='right'", "width='350'"] }
|
23
|
-
|
24
|
-
it "passes to api" do
|
25
|
-
allow(Twitter::REST::Client).to receive(:new).and_return(api_client)
|
26
|
-
allow(api_client).to receive(:status).with(12_345).and_return(status_response)
|
27
|
-
|
28
|
-
expect(api_client).to receive(:oembed).with(status_response, "align" => "right", "width" => "350").and_return("")
|
29
|
-
subject.fetch
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "with an invalid option" do
|
34
|
-
let(:params) { ["https://twitter.com/twitter_user/status/12345", "align=", "width='350'"] }
|
35
|
-
|
36
|
-
it "ignores param" do
|
37
|
-
allow(Twitter::REST::Client).to receive(:new).and_return(api_client)
|
38
|
-
allow(api_client).to receive(:status).with(12_345).and_return(status_response)
|
39
|
-
|
40
|
-
expect(api_client).to receive(:oembed).with(status_response, "width" => "350").and_return("")
|
41
|
-
subject.fetch
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#fetch" do
|
47
|
-
let(:params) { ["https://twitter.com/twitter_user/status/12345"] }
|
48
|
-
|
49
|
-
it "returns response from api" do
|
50
|
-
allow(Twitter::REST::Client).to receive(:new).and_return(api_client)
|
51
|
-
allow(api_client).to receive(:status).with(12_345).and_return(status_response)
|
52
|
-
|
53
|
-
expect(api_client).to receive(:oembed).with(status_response, {}).and_return("api response")
|
54
|
-
expect(subject.fetch).to eq "api response"
|
55
|
-
end
|
56
|
-
|
57
|
-
context "when status is not found" do
|
58
|
-
it "returns error" do
|
59
|
-
allow(Twitter::REST::Client).to receive(:new).and_return(api_client)
|
60
|
-
allow(api_client).to receive(:status).with(12_345).and_raise(Twitter::Error::NotFound)
|
61
|
-
|
62
|
-
expect(api_client).not_to receive(:oembed)
|
63
|
-
result = subject.fetch
|
64
|
-
expect(result).to be_a(TwitterJekyll::ErrorResponse)
|
65
|
-
expect(result.error).to eq "There was a 'Twitter::Error::NotFound' error fetching Tweet 'https://twitter.com/twitter_user/status/12345'"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "#cache_key" do
|
71
|
-
context "with no params" do
|
72
|
-
let(:params) { ["https://twitter.com/twitter_user/status/12345"] }
|
73
|
-
|
74
|
-
it "matches on status url" do
|
75
|
-
oembed_1 = TwitterJekyll::Oembed.new(api_client, params.dup)
|
76
|
-
oembed_2 = TwitterJekyll::Oembed.new(api_client, params.dup)
|
77
|
-
|
78
|
-
expect(
|
79
|
-
oembed_1.cache_key == oembed_2.cache_key
|
80
|
-
).to be true
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context "with params" do
|
85
|
-
let(:params_1) { ["https://twitter.com/twitter_user/status/12345", "align='right'"] }
|
86
|
-
let(:params_2) { ["https://twitter.com/twitter_user/status/12345", "align='left'"] }
|
87
|
-
|
88
|
-
it "matches on keys and values" do
|
89
|
-
oembed_1 = TwitterJekyll::Oembed.new(api_client, params_1.dup)
|
90
|
-
oembed_2 = TwitterJekyll::Oembed.new(api_client, params_2.dup)
|
91
|
-
oembed_3 = TwitterJekyll::Oembed.new(api_client, params_1.dup)
|
92
|
-
|
93
|
-
expect(
|
94
|
-
oembed_1.cache_key == oembed_2.cache_key
|
95
|
-
).to be false
|
96
|
-
|
97
|
-
expect(
|
98
|
-
oembed_1.cache_key == oembed_3.cache_key
|
99
|
-
).to be true
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|