Sha256: 6210eee1deeaa9e75cb200548b26728e0c86b7eddb18d6bbafefc75ca479bdfc

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

#--
# gravaty
# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019  Marco Bresciani
#
# This file is part of gravaty.
#
# gravaty is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# gravaty is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with gravaty. If not, see <http://www.gnu.org/licenses/>.
#++

require_relative '../../test_helper'

describe Gravaty::Utils::Downloader do
  describe 'when passed a nil uri' do
    it 'must raise a RuntimeError' do
      assert_raises RuntimeError do
        Gravaty::Utils::Downloader::Downloader
            .download_file nil, 'filename'
      end
    end
  end

  describe 'when passed an invalid uri' do
    it 'must raise a InvalidURIError' do
      assert_raises URI::InvalidURIError do
        Gravaty::Utils::Downloader::Downloader
            .download_file 'http://example.com/%uABCD',
                           'filename'
      end
    end
  end

  describe 'when passed a nil filename' do
    it 'must raise a TypeError' do
      assert_raises TypeError do
        Gravaty::Utils::Downloader::Downloader
            .download_file 'http://www.example.com', nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gravaty-9.0.1 test/gravaty/utils/test_downloader.rb
gravaty-9.0.0 test/gravaty/utils/test_downloader.rb