Skip to content

Commit

Permalink
add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Dec 13, 2011
1 parent dafa108 commit 719cc49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/youtube_search.rb
Expand Up @@ -11,8 +11,7 @@ def self.search(query, options={})
end

def self.playlist_videos(playlist_id)
playlist_id.gsub!(/^PL/, "")

playlist_id = playlist_id.sub(/^PL/, "")
xml = open("https://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?v=2").read
parse(xml, :type => :playlist)
end
Expand Down
6 changes: 6 additions & 0 deletions spec/youtube_search_spec.rb
Expand Up @@ -68,6 +68,12 @@
it "can retrieve videos from a playlist" do
YoutubeSearch.playlist_videos('5F23DAF4BFE3D14C').size.should == 6
end

it "can retrieve videos from a playlist with new-style ids" do
id = 'PL5F23DAF4BFE3D14C'
YoutubeSearch.playlist_videos(id).size.should == 6
id.should == 'PL5F23DAF4BFE3D14C'
end
end

describe 'options_with_per_page_and_page' do
Expand Down

0 comments on commit 719cc49

Please sign in to comment.