Sha256: dc6fcd5cde668ba3306a79922bfe619d75db5bda4939f1bafc76ddbacd31af1d
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
require "test_helper" describe DownloadTV::LinkGrabber do grabbers = DownloadTV::Torrent.new.grabbers 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
download_tv-2.1.0 | test/grabbers_test.rb |