forked from CocoaPods/Xcodeproj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxcodebuild_helper_spec.rb
83 lines (64 loc) · 2.44 KB
/
xcodebuild_helper_spec.rb
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
require File.expand_path('../spec_helper', __FILE__)
SPEC_XCODEBUILD_SAMPLE_SDK_OTPUT = <<-DOC
OS X SDKs:
Mac OS X 10.7 -sdk macosx10.7
OS X 10.8 -sdk macosx10.8
iOS SDKs:
iOS 6.1 -sdk iphoneos6.1
iOS Simulator SDKs:
Simulator - iOS 6.1 -sdk iphonesimulator6.1
tvOS SDKs:
tvOS 9.0 -sdk appletvos9.0
tvOS Simulator SDKs:
Simulator - tvOS 9.0 -sdk appletvsimulator9.0
watchOS SDKs:
Watch OS 2.0 -sdk watchos2.0
watchOS Simulator SDKs:
Simulator - Watch OS 2.0 -sdk watchsimulator2.0
DOC
module Xcodeproj
describe XcodebuildHelper do
before do
@helper = XcodebuildHelper.new
@helper.stubs(:xcodebuild_sdks).returns(SPEC_XCODEBUILD_SAMPLE_SDK_OTPUT)
end
#--------------------------------------------------------------------------------#
describe 'In general' do
before do
@helper.stubs(:xcodebuild_available?).returns(true)
end
it 'returns the last iOS SDK' do
@helper.last_ios_sdk.should == '6.1'
end
it 'returns the last OS X SDK' do
@helper.last_osx_sdk.should == '10.8'
end
it 'returns the last tvOS SDK' do
@helper.last_tvos_sdk.should == '9.0'
end
it 'returns the last watchOS SDK' do
@helper.last_watchos_sdk.should == '2.0'
end
end
#--------------------------------------------------------------------------------#
describe 'Private helpers' do
describe '#xcodebuild_available?' do
it 'returns whether the xcodebuild command is available' do
Process::Status.any_instance.expects(:exitstatus).returns(0)
@helper.send(:xcodebuild_available?).should.be.true
end
it 'returns whether the xcodebuild command is available' do
Process::Status.any_instance.expects(:exitstatus).returns(1)
@helper.send(:xcodebuild_available?).should.be.false
end
end
describe '#parse_sdks_information' do
it 'parses the sdks information returned by xcodebuild' do
result = @helper.send(:parse_sdks_information, SPEC_XCODEBUILD_SAMPLE_SDK_OTPUT)
result.should == [['macosx', '10.7'], ['macosx', '10.8'], ['iphoneos', '6.1'], ['appletvos', '9.0'], ['watchos', '2.0']]
end
end
end
#--------------------------------------------------------------------------------#
end
end