Sha256: 1aa91c33681e4cf20517652bb44703fcb224d0e9ec7275b0419d62a8c30c1261

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 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

      assert mock_module.download_binary_from_custom_uri
    end

    private

    def described_class
      Tester
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thermite-0.9.0 test/lib/thermite/custom_binary_test.rb
thermite-0.8.0 test/lib/thermite/custom_binary_test.rb