This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds some initial specs around the libxml formatter
- Loading branch information
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | |||
<oembed> | |||
<version>1.0</version> | |||
<type>photo</type> | |||
<title>Bacon Lollys</title> | |||
<author_name>bees</author_name> | |||
<author_url>http://www.flickr.com/photos/bees/</author_url> | |||
|
|||
<cache_age>3600</cache_age> | |||
<provider_name>Flickr</provider_name> | |||
<provider_url>http://www.flickr.com/</provider_url> | |||
<width>500</width> | |||
<height>375</height> | |||
<url>http://farm4.static.flickr.com/3040/2362225867_4a87ab8baf.jpg</url> | |||
</oembed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<oembed><provider_url>http://www.hulu.com/</provider_url><type>video</type><height>296</height><author_name>NBC</author_name><cache_age>3600</cache_age><thumbnail_url>http://thumbnails.hulu.com/8/500/23678_145x80_manicured__SIXr9mO9sUO3dYt+S-XTIw.jpg</thumbnail_url><html><object width="512" height="296"><param name="movie" value="http://www.hulu.com/embed/0-njKp22bl4GivFXH0lh5w"></param><embed src="http://www.hulu.com/embed/0-njKp22bl4GivFXH0lh5w" type="application/x-shockwave-flash" width="512" height="296"></embed></object></html><width>512</width><thumbnail_width>145</thumbnail_width><version>1.0</version><thumbnail_height>80</thumbnail_height><provider_name>Hulu</provider_name><title>Wed, May 21, 2008 (Late Night with Conan O'Brien)</title></oembed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<oembed> | |||
<version>1.0</version> | |||
<type>video</type> | |||
<width>437</width> | |||
<height>288</height> | |||
<title>iPhone macro lens demonstration</title> | |||
|
|||
<url>http://www.viddler.com/explore/cdevroe/videos/424/</url> | |||
<author_name>cdevroe</author_name> | |||
<author_url>http://www.viddler.com/explore/cdevroe/</author_url> | |||
<provider>Viddler</provider> | |||
<provider_url>http://www.viddler.com/</provider_url> | |||
<thumbnail_url>http://cdn-thumbs.viddler.com/thumbnail_2_1646c55_v1.jpg</thumbnail_url> | |||
|
|||
<thumbnail_width>437</thumbnail_width> | |||
<thumbnail_height>288</thumbnail_height> | |||
<html><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width= | |||
"437" height="288" id="viddlerplayer-1646c55"><param name="movie" value="http://www.viddler.com/player/1646c55/" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/1646c55/" width="437" height="288" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" wmode="transparent" name="viddlerplayer-1646c55" ></embed></object></html> | |||
</oembed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<oembed><provider_url>http://www.youtube.com/</provider_url><title>Auto-Tune the News #8: dragons. geese. Michael Vick. (ft. T-Pain)</title><html><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bDOYN-6gdRE&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bDOYN-6gdRE&fs=1" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed></object></html><author_name>schmoyoho</author_name><height>344</height><width>425</width><version>1.0</version><author_url>http://www.youtube.com/user/schmoyoho</author_url><provider_name>YouTube</provider_name><type>video</type></oembed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,62 @@ | |||
require File.join(File.dirname(__FILE__), "../spec_helper") | |||
require File.join(File.dirname(__FILE__), "../../lib/oembed_links/formatters/lib_xml.rb") | |||
|
|||
describe OEmbed::Formatters::LibXML do | |||
|
|||
describe "raw xml from youtube" do | |||
before(:each) do | |||
@youtube_xml = File.open( | |||
File.join(File.dirname(__FILE__), "example_xml/youtube.xml"), | |||
"rb" | |||
).read | |||
@result = OEmbed::Formatters::LibXML.new.format(@youtube_xml) | |||
end | |||
|
|||
it "parsed raw xml should contain some html" do | |||
@result["html"].empty?.should_not be_true | |||
end | |||
end | |||
|
|||
describe "raw xml from flickr" do | |||
before(:each) do | |||
@flickr_xml = File.open( | |||
File.join(File.dirname(__FILE__), "example_xml/flickr.xml"), | |||
"rb" | |||
).read | |||
@result = OEmbed::Formatters::LibXML.new.format(@flickr_xml) | |||
end | |||
|
|||
it "parsed raw xml should contain a url" do | |||
@result["url"].should == "http://farm4.static.flickr.com/3040/2362225867_4a87ab8baf.jpg" | |||
end | |||
end | |||
|
|||
describe "raw xml from viddler" do | |||
before(:each) do | |||
@viddler_xml = File.open( | |||
File.join(File.dirname(__FILE__), "example_xml/viddler.xml"), | |||
"rb" | |||
).read | |||
@result = OEmbed::Formatters::LibXML.new.format(@viddler_xml) | |||
end | |||
|
|||
it "parsed raw xml should contain some html" do | |||
@result["html"].empty?.should_not be_true | |||
end | |||
end | |||
|
|||
describe "raw xml from hulu" do | |||
before(:each) do | |||
@hulu_xml = File.open( | |||
File.join(File.dirname(__FILE__), "example_xml/hulu.xml"), | |||
"rb" | |||
).read | |||
@result = OEmbed::Formatters::LibXML.new.format(@hulu_xml) | |||
end | |||
|
|||
it "parsed raw xml should contain some html" do | |||
@result["html"].empty?.should_not be_true | |||
end | |||
end | |||
|
|||
end # Oembed |