aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/test
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-08 12:12:52 +0100
committerMarkus Reiter2017-02-10 17:19:19 +0100
commite637eb414e880559695a71b3fc1efbc7104ee64e (patch)
tree15f51eb77729c24f89459769a7a0d89294ea443d /Library/Homebrew/cask/test
parent3ef51dba055700ecca9a4f10e1fe0e714b7f9889 (diff)
downloadbrew-e637eb414e880559695a71b3fc1efbc7104ee64e.tar.bz2
Convert Fetch test to spec.
Diffstat (limited to 'Library/Homebrew/cask/test')
-rw-r--r--Library/Homebrew/cask/test/cask/cli/fetch_test.rb78
1 files changed, 0 insertions, 78 deletions
diff --git a/Library/Homebrew/cask/test/cask/cli/fetch_test.rb b/Library/Homebrew/cask/test/cask/cli/fetch_test.rb
deleted file mode 100644
index 8dd7e0ebf..000000000
--- a/Library/Homebrew/cask/test/cask/cli/fetch_test.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-require "test_helper"
-
-describe Hbc::CLI::Fetch do
- let(:local_transmission) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
- }
-
- let(:local_caffeine) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
- }
-
- it "allows download the installer of a Cask" do
- shutup do
- Hbc::CLI::Fetch.run("local-transmission", "local-caffeine")
- end
- Hbc::CurlDownloadStrategy.new(local_transmission).cached_location.must_be :exist?
- Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location.must_be :exist?
- end
-
- it "prevents double fetch (without nuking existing installation)" do
- download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
-
- shutup do
- Hbc::Download.new(local_transmission).perform
- end
- old_ctime = File.stat(download_stategy.cached_location).ctime
-
- shutup do
- Hbc::CLI::Fetch.run("local-transmission")
- end
- new_ctime = File.stat(download_stategy.cached_location).ctime
-
- old_ctime.to_i.must_equal new_ctime.to_i
- end
-
- it "allows double fetch with --force" do
- shutup do
- Hbc::Download.new(local_transmission).perform
- end
-
- download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
- old_ctime = File.stat(download_stategy.cached_location).ctime
- sleep(1)
-
- shutup do
- Hbc::CLI::Fetch.run("local-transmission", "--force")
- end
- download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
- new_ctime = File.stat(download_stategy.cached_location).ctime
-
- # new_ctime.to_i.must_be :>, old_ctime.to_i
- new_ctime.to_i.must_be :>, old_ctime.to_i
- end
-
- it "properly handles Casks that are not present" do
- lambda {
- shutup do
- Hbc::CLI::Fetch.run("notacask")
- end
- }.must_raise Hbc::CaskUnavailableError
- end
-
- describe "when no Cask is specified" do
- it "raises an exception" do
- lambda {
- Hbc::CLI::Fetch.run
- }.must_raise Hbc::CaskUnspecifiedError
- end
- end
-
- describe "when no Cask is specified, but an invalid option" do
- it "raises an exception" do
- lambda {
- Hbc::CLI::Fetch.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
- end
- end
-end