Sha256: e34f3587ee3d4ee5555c299a240eb783fa6d641fb33b0cb1a38613de143a8e58
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'minitest/autorun' require 'minitest/pride' require "youtube_images" def image_hash_for(id) @images_hash = { default: "http://img.youtube.com/vi/#{id}/default.jpg", medium: "http://img.youtube.com/vi/#{id}/hqdefault.jpg", high: "http://img.youtube.com/vi/#{id}/mqdefault.jpg", maximum: "http://img.youtube.com/vi/#{id}/maxresdefault.jpg" } end describe YouTubeImages do describe "when asked about images for a invalid youtube video" do it "must respond with an exception if the URL is invalid" do proc { YouTubeImages::For("http://asd") }.must_raise YouTubeImages::IncorrectYouTubeID end it "must respond with an exception if the URL is invalid" do proc { YouTubeImages::For("asdfasd") }.must_raise YouTubeImages::IncorrectYouTubeID end end describe "when asked about images for a youtube ID" do it "must respond with an image" do YouTubeImages::For("onghF8NYbPw").must_equal image_hash_for("onghF8NYbPw") end it "must respond with an image" do YouTubeImages::For("wrHU-DSirsw").must_equal image_hash_for("wrHU-DSirsw") end end describe "when asked about images for a youtube URL" do it "must respond with an image" do YouTubeImages::For("http://www.youtube.com/watch?v=onghF8NYbPw").must_equal image_hash_for("onghF8NYbPw") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
youtube_images-1.0.1 | spec/youtube_images_spec.rb |