aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/macos_spec.rb
blob: 2e385acd5336e36cbdcfe4748e86b142319f687c (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
describe MacOS, :cask do
  it "says '/' is undeletable" do
    expect(MacOS).to be_undeletable(
      "/",
    )
    expect(MacOS).to be_undeletable(
      "/.",
    )
    expect(MacOS).to be_undeletable(
      "/usr/local/Library/Taps/../../../..",
    )
  end

  it "says '/Applications' is undeletable" do
    expect(MacOS).to be_undeletable(
      "/Applications",
    )
    expect(MacOS).to be_undeletable(
      "/Applications/",
    )
    expect(MacOS).to be_undeletable(
      "/Applications/.",
    )
    expect(MacOS).to be_undeletable(
      "/Applications/Mail.app/..",
    )
  end

  it "says the home directory is undeletable" do
    expect(MacOS).to be_undeletable(
      Dir.home,
    )
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/",
    )
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/Documents/..",
    )
  end

  it "says the user library directory is undeletable" do
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/Library",
    )
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/Library/",
    )
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/Library/.",
    )
    expect(MacOS).to be_undeletable(
      "#{Dir.home}/Library/Preferences/..",
    )
  end

  it "says '/Applications/.app' is deletable" do
    expect(MacOS).not_to be_undeletable(
      "/Applications/.app",
    )
  end

  it "says '/Applications/SnakeOil Professional.app' is deletable" do
    expect(MacOS).not_to be_undeletable(
      "/Applications/SnakeOil Professional.app",
    )
  end
end