Sha256: d9e759546a410cc5cfd913dab2ede5232d7a9371a9935822283b76b8b1242c02
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
require "test_helper" describe DownloadTV::LinkGrabber do grabbers = ["Eztv", "ThePirateBay", "TorrentAPI"] instances = grabbers.map { |g| (DownloadTV.const_get g).new } instances.each do |grabber| describe grabber do # grabber = g#(Object.const_get "DownloadTV::#{g}").new it "will have a url attribute on creation" do # instance_eval("#{g}.new") grabber.url.wont_be_nil end it "should get a 200 code response" do # grabber = (Object.const_get g).new grabber.test_connection.code.must_equal "200" end it "will raise NoTorrentsError when torrent can't be found" do # grabber = (Object.const_get g).new notfound = ->{ grabber.get_links("Totally Fake Show askjdgsaudas") } notfound.must_raise DownloadTV::NoTorrentsError end it "will return an array with names and links of results when a torrent can be found" do # grabber = (Object.const_get g).new result = grabber.get_links("Game Of Thrones S04E01") result.must_be_instance_of Array result.wont_be :empty? result.each do |r| r.size.must_equal 2 r[0].must_be_instance_of String r[0].upcase.must_include "THRONES" r[1].must_be_instance_of String end end end end it "raises an error if the instance doesn't implement get_links" do ->{ DownloadTV::LinkGrabber.new("").get_links("test") }.must_raise NotImplementedError end end
Version data entries
5 entries across 5 versions & 1 rubygems