aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/test
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-08 14:37:40 +0100
committerMarkus Reiter2017-02-10 17:19:19 +0100
commite5e8f545b72f4a8849a915dfba1acce5f39ef3ab (patch)
tree31e9e8699772d4c0368c3973f1e59b69b81a465c /Library/Homebrew/cask/test
parent3db8cdf8613694a26051e0ee291f931a7ca00ae3 (diff)
downloadbrew-e5e8f545b72f4a8849a915dfba1acce5f39ef3ab.tar.bz2
Convert Artifact::Pkg test to spec.
Diffstat (limited to 'Library/Homebrew/cask/test')
-rw-r--r--Library/Homebrew/cask/test/cask/artifact/pkg_test.rb64
1 files changed, 0 insertions, 64 deletions
diff --git a/Library/Homebrew/cask/test/cask/artifact/pkg_test.rb b/Library/Homebrew/cask/test/cask/artifact/pkg_test.rb
deleted file mode 100644
index b054290ce..000000000
--- a/Library/Homebrew/cask/test/cask/artifact/pkg_test.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require "test_helper"
-
-describe Hbc::Artifact::Pkg do
- before do
- @cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb")
- shutup do
- TestHelper.install_without_artifacts(@cask)
- end
- end
-
- describe "install_phase" do
- it "runs the system installer on the specified pkgs" do
- pkg = Hbc::Artifact::Pkg.new(@cask,
- command: Hbc::FakeSystemCommand)
-
- Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/"])
-
- shutup do
- pkg.install_phase
- end
- end
- end
-
- describe "choices" do
- before do
- @cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-choices.rb")
- shutup do
- TestHelper.install_without_artifacts(@cask)
- end
- end
-
- it "passes the choice changes xml to the system installer" do
- pkg = Hbc::Artifact::Pkg.new(@cask, command: Hbc::FakeSystemCommand)
-
- file = mock
- file.expects(:write).with <<-EOS.undent
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <array>
- \t<dict>
- \t\t<key>attributeSetting</key>
- \t\t<integer>1</integer>
- \t\t<key>choiceAttribute</key>
- \t\t<string>selected</string>
- \t\t<key>choiceIdentifier</key>
- \t\t<string>choice1</string>
- \t</dict>
- </array>
- </plist>
- EOS
- file.stubs path: Pathname.new("/tmp/choices.xml")
- file.expects(:close)
- file.expects(:unlink)
- Tempfile.expects(:open).yields file
-
- Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", @cask.staged_path.join("/tmp/choices.xml")])
-
- shutup do
- pkg.install_phase
- end
- end
- end
-end