Sha256: 3655d9c162fcc8892f5d5e477f996e14d6634e8a75b15ce1563260ef888cc9b2

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'test_helper'

describe DownloadTV::Torrent do
  grabber_names = DownloadTV::Torrent.new(nil).grabbers
  describe 'when creating the object' do
    before do
      @t = DownloadTV::Torrent.new
    end

    it 'will populate the instances' do
      _(@t.g_instances.size).must_equal grabber_names.size
    end

    it 'will start with all tries available' do
      _(@t.tries).must_equal grabber_names.size - 1
    end

    it 'will call get_links on its grabber' do
      @t.g_instances.first.stub :get_links, %w[test result] do
        _(@t.get_links('test show')).must_equal %w[test result]
      end
    end
  end

  describe 'when giving it a default grabber' do
    it 'has a default order' do
      t = DownloadTV::Torrent.new(nil)
      expected = grabber_names.map { |i| "DownloadTV::#{i}" }
      _(t.g_instances.map { |i| i.class.name }).must_equal expected
    end

    grabber_names.each do |g|
      it 'correctly uses the given grabber first' do
        t = DownloadTV::Torrent.new(g)
        _(t.g_instances.first.class.name).must_equal "DownloadTV::#{g}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
download_tv-2.6.6 test/torrent_test.rb
download_tv-2.6.5 test/torrent_test.rb
download_tv-2.6.4 test/torrent_test.rb
download_tv-2.6.3 test/torrent_test.rb
download_tv-2.6.2 test/torrent_test.rb
download_tv-2.6.1 test/torrent_test.rb