remove newlines from runtime bundle IDs

* create `staged_test.rb` for testing staged Casks
* test an actual staged Cask rather than mocking
This commit is contained in:
Roland Walker 2014-12-06 14:17:00 -05:00
parent 98fa063277
commit 2e71e5110d
3 changed files with 21 additions and 2 deletions

View File

@ -15,6 +15,6 @@ module Cask::Staged
end
def bundle_identifier
plist_exec('Print CFBundleIdentifier')
plist_exec('Print CFBundleIdentifier').stdout.chomp
end
end

View File

@ -29,7 +29,7 @@ describe Cask::DSL::Postflight do
['/usr/libexec/PlistBuddy', '-c', 'Print CFBundleIdentifier', @dsl.info_plist],
'com.example.BasicCask'
)
@dsl.bundle_identifier.stdout.must_equal 'com.example.BasicCask'
@dsl.bundle_identifier.must_equal 'com.example.BasicCask'
end
it "can set a key in the Info.plist file" do

19
test/cask/staged_test.rb Normal file
View File

@ -0,0 +1,19 @@
require 'test_helper'
# todo: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb. It makes little sense
# to be invoking bundle_identifier off of the postflight instance.
describe "Operations on staged Casks" do
describe "bundle ID DSL" do
it "fetches the bundle ID from a staged cask" do
transmission_cask = Cask.load('local-transmission')
tr_installer = Cask::Installer.new(transmission_cask)
tr_postflight = Cask::DSL::Postflight.new(transmission_cask)
shutup do
tr_installer.install
end
tr_postflight.bundle_identifier.must_equal('org.m0k.transmission')
end
end
end