From fef96f0ba8f4e984dfc053c9d256b0a2c0000543 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 24 Aug 2016 00:41:50 +0200 Subject: Move part of `parser_test` to `system_command_result_spec`. --- .../cask/spec/cask/system_command_result_spec.rb | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Library/Homebrew/cask/spec/cask/system_command_result_spec.rb (limited to 'Library/Homebrew/cask/spec') diff --git a/Library/Homebrew/cask/spec/cask/system_command_result_spec.rb b/Library/Homebrew/cask/spec/cask/system_command_result_spec.rb new file mode 100644 index 000000000..7eb4fb722 --- /dev/null +++ b/Library/Homebrew/cask/spec/cask/system_command_result_spec.rb @@ -0,0 +1,49 @@ +require "spec_helper" + +describe Hbc::SystemCommand::Result do + describe "::_parse_plist" do + let(:command) { Hbc::SystemCommand.new("/usr/bin/true", {}) } + let(:hdiutil_output) { + <<-EOS.undent + Hello there! I am in no way XML am I?!?! + + That's a little silly... you were expexting XML here! + + What is a parser to do? + + Hopefully explode! + + + + + + system-entities + + + content-hint + Apple_HFS + dev-entry + /dev/disk3s2 + mount-point + /private/tmp/dmg.BhfS2g + potentially-mountable + + unmapped-content-hint + Apple_HFS + volume-kind + hfs + + + + + EOS + } + + it "ignores garbage output before xml starts" do + parsed = described_class._parse_plist(command, hdiutil_output) + + expect(parsed.keys).to eq(["system-entities"]) + expect(parsed["system-entities"].length).to eq(1) + end + end +end -- cgit v1.2.3