onebox 1.5.3 → 1.5.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 +4 -4
- data/lib/onebox/engine.rb +1 -0
- data/lib/onebox/engine/douban_onebox.rb +22 -0
- data/lib/onebox/matcher.rb +2 -1
- data/lib/onebox/version.rb +1 -1
- data/spec/fixtures/douban.response +4399 -0
- data/spec/lib/onebox/engine/douban_onebox_spec.rb +29 -0
- data/spec/lib/onebox/matcher_spec.rb +11 -0
- data/templates/douban.mustache +5 -0
- metadata +9 -3
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Onebox::Engine::DoubanOnebox do
|
4
|
+
before(:all) do
|
5
|
+
@link = "http://movie.douban.com/review/1503949/"
|
6
|
+
end
|
7
|
+
include_context "engines"
|
8
|
+
it_behaves_like "an engine"
|
9
|
+
|
10
|
+
before do
|
11
|
+
fake(link, response("douban.response"))
|
12
|
+
end
|
13
|
+
|
14
|
+
it "has douban title" do
|
15
|
+
expect(html).to include("那个荡气回肠的长镜头 (巴黎最后的探戈 影评)")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "has douban image" do
|
19
|
+
expect(html).to include("http://img3.douban.com/mpic/s2557510.jpg")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "has the douban description" do
|
23
|
+
expect(html).to include("<p>那个荡气回肠的长镜头")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "has the URL to the resource" do
|
27
|
+
expect(html).to include(link)
|
28
|
+
end
|
29
|
+
end
|
@@ -39,5 +39,16 @@ describe Onebox::Matcher do
|
|
39
39
|
matcher.oneboxed.should_not be_nil
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
describe "without a path but has a fragment string" do
|
44
|
+
let(:url) { "http://party.time.made.up-url.com/#article_id=1234" }
|
45
|
+
let(:matcher) { Onebox::Matcher.new(url) }
|
46
|
+
|
47
|
+
it "it finds an engine" do
|
48
|
+
matcher.stubs(:ordered_engines).returns([TestEngine])
|
49
|
+
matcher.oneboxed.should_not be_nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
42
53
|
end
|
43
54
|
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.5.
|
4
|
+
version: 1.5.5
|
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-
|
13
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- lib/onebox/engine/amazon_onebox.rb
|
247
247
|
- lib/onebox/engine/audio_onebox.rb
|
248
248
|
- lib/onebox/engine/classic_google_maps_onebox.rb
|
249
|
+
- lib/onebox/engine/douban_onebox.rb
|
249
250
|
- lib/onebox/engine/github_blob_onebox.rb
|
250
251
|
- lib/onebox/engine/github_commit_onebox.rb
|
251
252
|
- lib/onebox/engine/github_gist_onebox.rb
|
@@ -273,6 +274,7 @@ files:
|
|
273
274
|
- onebox.gemspec
|
274
275
|
- spec/fixtures/amazon.response
|
275
276
|
- spec/fixtures/dailymail.response
|
277
|
+
- spec/fixtures/douban.response
|
276
278
|
- spec/fixtures/githubblob.response
|
277
279
|
- spec/fixtures/githubcommit.response
|
278
280
|
- spec/fixtures/githubpullrequest.response
|
@@ -290,6 +292,7 @@ files:
|
|
290
292
|
- spec/lib/onebox/engine/amazon_onebox_spec.rb
|
291
293
|
- spec/lib/onebox/engine/audio_onebox_spec.rb
|
292
294
|
- spec/lib/onebox/engine/classic_google_maps_onebox_spec.rb
|
295
|
+
- spec/lib/onebox/engine/douban_onebox_spec.rb
|
293
296
|
- spec/lib/onebox/engine/github_blob_onebox_spec.rb
|
294
297
|
- spec/lib/onebox/engine/github_commit_onebox_spec.rb
|
295
298
|
- spec/lib/onebox/engine/github_gist_onebox_spec.rb
|
@@ -314,6 +317,7 @@ files:
|
|
314
317
|
- spec/support/html_spec_helper.rb
|
315
318
|
- templates/_layout.mustache
|
316
319
|
- templates/amazon.mustache
|
320
|
+
- templates/douban.mustache
|
317
321
|
- templates/githubblob.mustache
|
318
322
|
- templates/githubcommit.mustache
|
319
323
|
- templates/githubissue.mustache
|
@@ -344,13 +348,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
348
|
version: '0'
|
345
349
|
requirements: []
|
346
350
|
rubyforge_project:
|
347
|
-
rubygems_version: 2.
|
351
|
+
rubygems_version: 2.1.11
|
348
352
|
signing_key:
|
349
353
|
specification_version: 4
|
350
354
|
summary: A gem for turning URLs into previews.
|
351
355
|
test_files:
|
352
356
|
- spec/fixtures/amazon.response
|
353
357
|
- spec/fixtures/dailymail.response
|
358
|
+
- spec/fixtures/douban.response
|
354
359
|
- spec/fixtures/githubblob.response
|
355
360
|
- spec/fixtures/githubcommit.response
|
356
361
|
- spec/fixtures/githubpullrequest.response
|
@@ -368,6 +373,7 @@ test_files:
|
|
368
373
|
- spec/lib/onebox/engine/amazon_onebox_spec.rb
|
369
374
|
- spec/lib/onebox/engine/audio_onebox_spec.rb
|
370
375
|
- spec/lib/onebox/engine/classic_google_maps_onebox_spec.rb
|
376
|
+
- spec/lib/onebox/engine/douban_onebox_spec.rb
|
371
377
|
- spec/lib/onebox/engine/github_blob_onebox_spec.rb
|
372
378
|
- spec/lib/onebox/engine/github_commit_onebox_spec.rb
|
373
379
|
- spec/lib/onebox/engine/github_gist_onebox_spec.rb
|