aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/container
diff options
context:
space:
mode:
authorMarkus Reiter2017-03-05 06:31:36 +0100
committerMarkus Reiter2017-03-05 23:08:14 +0100
commit9fc6c7b2be300ff35dc52d80f4dc38d36d52ddc2 (patch)
tree43e99a683329471c1dc965dcc92daccb57df7e8d /Library/Homebrew/test/cask/container
parent67ec76d1492fbb03959a782a85c4fb985d6a5884 (diff)
downloadbrew-9fc6c7b2be300ff35dc52d80f4dc38d36d52ddc2.tar.bz2
Move Cask specs into `brew tests`.
Diffstat (limited to 'Library/Homebrew/test/cask/container')
-rw-r--r--Library/Homebrew/test/cask/container/dmg_spec.rb20
-rw-r--r--Library/Homebrew/test/cask/container/naked_spec.rb23
2 files changed, 43 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/container/dmg_spec.rb b/Library/Homebrew/test/cask/container/dmg_spec.rb
new file mode 100644
index 000000000..a94362aba
--- /dev/null
+++ b/Library/Homebrew/test/cask/container/dmg_spec.rb
@@ -0,0 +1,20 @@
+describe Hbc::Container::Dmg, :cask do
+ describe "#mount!" do
+ it "does not store nil mounts for dmgs with extra data" do
+ transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
+
+ dmg = Hbc::Container::Dmg.new(
+ transmission,
+ Pathname(transmission.url.path),
+ Hbc::SystemCommand,
+ )
+
+ begin
+ dmg.mount!
+ expect(dmg.mounts).not_to include nil
+ ensure
+ dmg.eject!
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/cask/container/naked_spec.rb b/Library/Homebrew/test/cask/container/naked_spec.rb
new file mode 100644
index 000000000..eb30ef81a
--- /dev/null
+++ b/Library/Homebrew/test/cask/container/naked_spec.rb
@@ -0,0 +1,23 @@
+describe Hbc::Container::Naked, :cask do
+ it "saves files with spaces in them from uris with encoded spaces" do
+ cask = Hbc::Cask.new("spacey") do
+ url "http://example.com/kevin%20spacey.pkg"
+ version "1.2"
+ end
+
+ path = "/tmp/downloads/kevin-spacey-1.2.pkg"
+ expected_destination = cask.staged_path.join("kevin spacey.pkg")
+ expected_command = ["/usr/bin/ditto", "--", path, expected_destination]
+ Hbc::FakeSystemCommand.stubs_command(expected_command)
+
+ container = Hbc::Container::Naked.new(cask, path, Hbc::FakeSystemCommand)
+
+ expect {
+ shutup do
+ container.extract
+ end
+ }.not_to raise_error
+
+ expect(Hbc::FakeSystemCommand.system_calls[expected_command]).to eq(1)
+ end
+end