ruby-oembed 0.8.11 → 0.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.rdoc +7 -0
- data/lib/oembed/provider.rb +6 -1
- data/lib/oembed/providers/embedly_urls.yml +255 -136
- data/lib/oembed/providers.rb +20 -1
- data/lib/oembed/version.rb +1 -1
- data/spec/formatter/ducktype_backend_spec.rb +31 -31
- data/spec/formatter/json/jsongem_backend_spec.rb +29 -28
- data/spec/formatter/json/yaml_backend_spec.rb +27 -26
- data/spec/formatter/xml/nokogiri_backend_spec.rb +28 -27
- data/spec/formatter/xml/rexml_backend_spec.rb +26 -25
- data/spec/formatter/xml/xmlsimple_backend_spec.rb +28 -27
- data/spec/formatter_spec.rb +11 -9
- data/spec/provider_discovery_spec.rb +37 -37
- metadata +2 -2
@@ -14,9 +14,9 @@ describe OEmbed::ProviderDiscovery do
|
|
14
14
|
after(:all) do
|
15
15
|
VCR.eject_cassette
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
include OEmbedSpecHelper
|
19
|
-
|
19
|
+
|
20
20
|
{
|
21
21
|
'youtube' => [
|
22
22
|
'http://www.youtube.com/watch?v=u6XAPnuFjJc',
|
@@ -39,11 +39,11 @@ describe OEmbed::ProviderDiscovery do
|
|
39
39
|
# :json,
|
40
40
|
#],
|
41
41
|
}.each do |context, urls|
|
42
|
-
|
42
|
+
|
43
43
|
given_url, expected_endpoint, expected_format = urls
|
44
|
-
|
44
|
+
|
45
45
|
context "with #{context} url" do
|
46
|
-
|
46
|
+
|
47
47
|
describe "discover_provider" do
|
48
48
|
|
49
49
|
before(:all) do
|
@@ -53,64 +53,64 @@ describe OEmbed::ProviderDiscovery do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should return the correct Class" do
|
56
|
-
@provider_default.
|
57
|
-
@provider_json.
|
58
|
-
@provider_xml.
|
56
|
+
expect(@provider_default).to be_instance_of(OEmbed::Provider)
|
57
|
+
expect(@provider_json).to be_instance_of(OEmbed::Provider)
|
58
|
+
expect(@provider_xml).to be_instance_of(OEmbed::Provider)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should detect the correct URL" do
|
62
62
|
if expected_endpoint.is_a?(Hash)
|
63
|
-
@provider_json.endpoint.
|
64
|
-
@provider_json.endpoint.
|
65
|
-
@provider_xml.endpoint.
|
63
|
+
expect(@provider_json.endpoint).to eq(expected_endpoint[expected_format])
|
64
|
+
expect(@provider_json.endpoint).to eq(expected_endpoint[:json])
|
65
|
+
expect(@provider_xml.endpoint).to eq(expected_endpoint[:xml])
|
66
66
|
else
|
67
|
-
@provider_default.endpoint.
|
68
|
-
@provider_json.endpoint.
|
69
|
-
@provider_xml.endpoint.
|
67
|
+
expect(@provider_default.endpoint).to eq(expected_endpoint)
|
68
|
+
expect(@provider_json.endpoint).to eq(expected_endpoint)
|
69
|
+
expect(@provider_xml.endpoint).to eq(expected_endpoint)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should return the correct format" do
|
74
|
-
@provider_default.format.
|
75
|
-
@provider_json.format.
|
76
|
-
@provider_xml.format.
|
74
|
+
expect(@provider_default.format).to eq(expected_format)
|
75
|
+
expect(@provider_json.format).to eq(:json)
|
76
|
+
expect(@provider_xml.format).to eq(:xml)
|
77
77
|
end
|
78
78
|
end # discover_provider
|
79
79
|
|
80
80
|
describe "get" do
|
81
|
-
|
81
|
+
|
82
82
|
before(:all) do
|
83
83
|
@response_default = OEmbed::ProviderDiscovery.get(given_url)
|
84
84
|
@response_json = OEmbed::ProviderDiscovery.get(given_url, :format=>:json)
|
85
85
|
@response_xml = OEmbed::ProviderDiscovery.get(given_url, :format=>:xml)
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
it "should return the correct Class" do
|
89
|
-
@response_default.
|
90
|
-
@response_json.
|
91
|
-
@response_xml.
|
89
|
+
expect(@response_default).to be_kind_of(OEmbed::Response)
|
90
|
+
expect(@response_json).to be_kind_of(OEmbed::Response)
|
91
|
+
expect(@response_xml).to be_kind_of(OEmbed::Response)
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
it "should return the correct format" do
|
95
|
-
@response_default.format.
|
96
|
-
@response_json.format.
|
97
|
-
@response_xml.format.
|
95
|
+
expect(@response_default.format).to eq(expected_format.to_s)
|
96
|
+
expect(@response_json.format).to eq('json')
|
97
|
+
expect(@response_xml.format).to eq('xml')
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
it "should return the correct data" do
|
101
|
-
@response_default.type.
|
102
|
-
@response_json.type.
|
103
|
-
@response_xml.type.
|
104
|
-
|
105
|
-
# Technically, the following values _could_ be blank, but for the
|
101
|
+
expect(@response_default.type).to_not be_nil
|
102
|
+
expect(@response_json.type).to_not be_nil
|
103
|
+
expect(@response_xml.type).to_not be_nil
|
104
|
+
|
105
|
+
# Technically, the following values _could_ be blank, but for the
|
106
106
|
# examples urls we're using we expect them not to be.
|
107
|
-
@response_default.title.
|
108
|
-
@response_json.title.
|
109
|
-
@response_xml.title.
|
107
|
+
expect(@response_default.title).to_not be_nil
|
108
|
+
expect(@response_json.title).to_not be_nil
|
109
|
+
expect(@response_xml.title).to_not be_nil
|
110
110
|
end
|
111
111
|
end # get
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
end # each service
|
115
|
-
|
115
|
+
|
116
116
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-oembed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Holm
|
@@ -184,7 +184,7 @@ rdoc_options:
|
|
184
184
|
- "--main"
|
185
185
|
- README.rdoc
|
186
186
|
- "--title"
|
187
|
-
- ruby-oembed-0.8.
|
187
|
+
- ruby-oembed-0.8.12
|
188
188
|
- "--inline-source"
|
189
189
|
- "--exclude"
|
190
190
|
- tasks
|