Sha256: e5e82491df4962916e2627be268d9bf37e0fc38a50d303b6f56f92dda915eaf0

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

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
      next unless grabber.online?

      it 'will have a url attribute on creation' do
        _(grabber.url).wont_be_nil
      end

      it "will raise NoTorrentsError when torrent can't be found" do
        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
        result = grabber.get_links('The Boys S02E01')
        _(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 'BOYS'
          _(r[1]).must_be_instance_of String
          _(r[1]).must_include 'magnet:'
        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

16 entries across 16 versions & 1 rubygems

Version Path
download_tv-2.9.1 test/grabbers_test.rb
download_tv-2.9.0 test/grabbers_test.rb
download_tv-2.8.5 test/grabbers_test.rb
download_tv-2.8.4 test/grabbers_test.rb
download_tv-2.8.3 test/grabbers_test.rb
download_tv-2.8.2 test/grabbers_test.rb
download_tv-2.8.1 test/grabbers_test.rb
download_tv-2.8.0 test/grabbers_test.rb
download_tv-2.7.0 test/grabbers_test.rb
download_tv-2.6.10 test/grabbers_test.rb
download_tv-2.6.9 test/grabbers_test.rb
download_tv-2.6.8 test/grabbers_test.rb
download_tv-2.6.7 test/grabbers_test.rb
download_tv-2.6.6 test/grabbers_test.rb
download_tv-2.6.5 test/grabbers_test.rb
download_tv-2.6.4 test/grabbers_test.rb