Sha256: adff30f2277eb34f12acf6e685b0e09fed7f55d9ab89e02db12b4e9acea6ebc3

Contents?: true

Size: 905 Bytes

Versions: 13

Compression:

Stored size: 905 Bytes

Contents

require "test_helper"

class FileDownloaderTest < Test::Unit::TestCase
  setup do
    @downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::File)
    @uri = "foo.box"
  end

  context "preparing" do
    should "raise an exception if the file does not exist" do
      File.expects(:file?).with(@uri).returns(false)

      assert_raises(Vagrant::Errors::DownloaderFileDoesntExist) {
        @downloader.prepare(@uri)
      }
    end
  end

  context "downloading" do
    should "cp the file" do
      path = '/path'
      @tempfile.expects(:path).returns(path)
      FileUtils.expects(:cp).with(@uri, path)
      @downloader.download!(@uri, @tempfile)
    end
  end

  context "matching a uri" do
    should "return true if the File exists on the file system" do
      File.expects(:exists?).with('foo').returns(true)
      assert Vagrant::Downloaders::File.match?('foo')
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
vagrantup-0.6.9 test/vagrant/downloaders/file_test.rb
vagrantup-0.6.8 test/vagrant/downloaders/file_test.rb
vagrantup-0.6.7 test/vagrant/downloaders/file_test.rb
vagrantup-0.6.6 test/vagrant/downloaders/file_test.rb
vagrantup-0.6.5 test/vagrant/downloaders/file_test.rb
vagrantup-0.6.4 test/vagrant/downloaders/file_test.rb
vagrant-0.7.0.beta test/vagrant/downloaders/file_test.rb
vagrant-0.6.9 test/vagrant/downloaders/file_test.rb
vagrant-0.6.8 test/vagrant/downloaders/file_test.rb
vagrant-0.6.7 test/vagrant/downloaders/file_test.rb
vagrant-0.6.6 test/vagrant/downloaders/file_test.rb
vagrant-0.6.5 test/vagrant/downloaders/file_test.rb
vagrant-0.6.4 test/vagrant/downloaders/file_test.rb