Sha256: 610e78f2fee19ba169ef0bee36a55b2ae3b6186ea94a450927f2e4b63617478e
Contents?: true
Size: 1.93 KB
Versions: 2
Compression:
Stored size: 1.93 KB
Contents
require 'spec_helper' module Wrapp describe AppInfo do let(:app) { AppInfo.new('Info.plist') } before do AppInfo.any_instance.stub(:`) end describe '#full_name' do it 'includes the downcased name and version without spaces' do app.stub(:name).and_return("Chunky\t Bacon") app.stub(:version).and_return('1.2.3') expect(app.full_name).to eq('chunky_bacon_1.2.3') end end describe '#name' do it 'returns the app name' do app.should_receive(:get_property). with('CFBundleName'). and_return('Chunky Bacon') expect(app.name).to eq('Chunky Bacon') end end describe '#version' do it 'returns the app version' do app.should_receive(:get_property). with('CFBundleShortVersionString'). and_return('0.4.2') expect(app.version).to eq('0.4.2') end end describe '#get_property' do let(:command_line) { double('command_line', :run => '') } before do Cocaine::CommandLine.stub(:new).and_return(command_line) end it 'builds a new command line object' do Cocaine::CommandLine.should_receive(:new). with('/usr/libexec/PlistBuddy', '-c :cmd :plist'). and_return(command_line) app.get_property('Foo') end it 'runs the command line with the property' do command_line.should_receive(:run). with(:cmd => 'Print Foo', :plist => 'Info.plist'). and_return('') app.get_property('Foo') end it 'strips the output' do command_line.stub(:run).and_return("Chunky\n") expect(app.get_property('')).to eq('Chunky') end it 'raises when plistbuddy exists non-zero' do app.stub(:`).and_return { system('false'); '' } expect { app.get_property('Foo') }.to raise_error /error reading foo from info.plist/i end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wrapp-0.5.1 | spec/wrapp/app_info_spec.rb |
wrapp-0.5.0 | spec/wrapp/app_info_spec.rb |