Sha256: 660ca84cf21a54d352e42ce92bae745f7061de22ba831c26be4c37b70724a6d1

Contents?: true

Size: 934 Bytes

Versions: 16

Compression:

Stored size: 934 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')

class FileDownloaderTest < Test::Unit::TestCase
  setup do
    @downloader, @tempfile = 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::Actions::ActionException) {
        @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

16 entries across 16 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/downloaders/file_test.rb
vagrantup-0.4.1 test/vagrant/downloaders/file_test.rb
vagrantup-0.4.0 test/vagrant/downloaders/file_test.rb
vagrantup-0.3.4 test/vagrant/downloaders/file_test.rb
vagrantup-0.3.3 test/vagrant/downloaders/file_test.rb
vagrantup-0.3.2 test/vagrant/downloaders/file_test.rb
vagrantup-0.3.1 test/vagrant/downloaders/file_test.rb
vagrantup-0.3.0 test/vagrant/downloaders/file_test.rb
vagrant-0.4.2 test/vagrant/downloaders/file_test.rb
vagrant-0.4.1 test/vagrant/downloaders/file_test.rb
vagrant-0.4.0 test/vagrant/downloaders/file_test.rb
vagrant-0.3.4 test/vagrant/downloaders/file_test.rb
vagrant-0.3.3 test/vagrant/downloaders/file_test.rb
vagrant-0.3.2 test/vagrant/downloaders/file_test.rb
vagrant-0.3.1 test/vagrant/downloaders/file_test.rb
vagrant-0.3.0 test/vagrant/downloaders/file_test.rb