Sha256: 8ddccbce2913e42806de14271e542a3ae589149bfdc83ca1b0162a153bf430e9

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'tmpdir'
require 'test_helper'
require 'thermite/custom_binary'
require 'thermite/util'

module Thermite
  class CustomBinaryTest < Minitest::Test
    include Thermite::ModuleTester

    class Tester
      include Thermite::CustomBinary
      include Thermite::TestHelper
      include Thermite::Util
    end

    def test_no_downloading_when_binary_uri_is_falsey
      mock_module(binary_uri_format: false)
      mock_module.expects(:http_get).never

      assert !mock_module.download_binary_from_custom_uri
    end

    def test_download_binary_from_custom_uri
      mock_module(binary_uri_format: 'http://example.com/download/%{version}/%{filename}')
      mock_module.config.stubs(:toml).returns(package: { version: '4.5.6' })
      Net::HTTP.stubs(:get_response).returns('location' => 'redirect')
      mock_module.stubs(:http_get).returns('tarball')
      mock_module.expects(:unpack_tarball).once
      mock_module.expects(:prepare_downloaded_library).once

      assert mock_module.download_binary_from_custom_uri
    end

    private

    def described_class
      Tester
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thermite-0.12.1 test/lib/thermite/custom_binary_test.rb
thermite-0.12.0 test/lib/thermite/custom_binary_test.rb
thermite-0.11.1 test/lib/thermite/custom_binary_test.rb
thermite-0.11.0 test/lib/thermite/custom_binary_test.rb
thermite-0.10.0 test/lib/thermite/custom_binary_test.rb