aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/spec/cask/container/naked_spec.rb
blob: ee4102ecabc2e63409bfe328a0890d0e361e74af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require "spec_helper"

describe Hbc::Container::Naked 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