From e637eb414e880559695a71b3fc1efbc7104ee64e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 8 Feb 2017 12:12:52 +0100 Subject: [PATCH] Convert Fetch test to spec. --- .../cask/cli/fetch_spec.rb} | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) rename Library/Homebrew/cask/{test/cask/cli/fetch_test.rb => spec/cask/cli/fetch_spec.rb} (77%) diff --git a/Library/Homebrew/cask/test/cask/cli/fetch_test.rb b/Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb similarity index 77% rename from Library/Homebrew/cask/test/cask/cli/fetch_test.rb rename to Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb index 8dd7e0ebfb..bb81334532 100644 --- a/Library/Homebrew/cask/test/cask/cli/fetch_test.rb +++ b/Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb @@ -1,4 +1,4 @@ -require "test_helper" +require "spec_helper" describe Hbc::CLI::Fetch do let(:local_transmission) { @@ -13,8 +13,8 @@ describe Hbc::CLI::Fetch 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? + expect(Hbc::CurlDownloadStrategy.new(local_transmission).cached_location).to exist + expect(Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location).to exist end it "prevents double fetch (without nuking existing installation)" do @@ -30,7 +30,7 @@ describe Hbc::CLI::Fetch do end new_ctime = File.stat(download_stategy.cached_location).ctime - old_ctime.to_i.must_equal new_ctime.to_i + expect(old_ctime.to_i).to eq(new_ctime.to_i) end it "allows double fetch with --force" do @@ -48,31 +48,30 @@ describe Hbc::CLI::Fetch do 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 + expect(new_ctime.to_i).to be > old_ctime.to_i end it "properly handles Casks that are not present" do - lambda { + expect { shutup do Hbc::CLI::Fetch.run("notacask") end - }.must_raise Hbc::CaskUnavailableError + }.to raise_error(Hbc::CaskUnavailableError) end describe "when no Cask is specified" do it "raises an exception" do - lambda { + expect { Hbc::CLI::Fetch.run - }.must_raise Hbc::CaskUnspecifiedError + }.to raise_error(Hbc::CaskUnspecifiedError) end end describe "when no Cask is specified, but an invalid option" do it "raises an exception" do - lambda { + expect { Hbc::CLI::Fetch.run("--notavalidoption") - }.must_raise Hbc::CaskUnspecifiedError + }.to raise_error(Hbc::CaskUnspecifiedError) end end end