1
1
require 'rubygems'
2
2
require 'bundler/setup'
3
+ Bundler . setup
4
+ require 'xctasks/test_task'
3
5
require 'rakeup'
4
- require 'debugger'
5
6
6
7
RakeUp ::ServerTask . new do |t |
7
8
t . port = 4567
@@ -10,39 +11,31 @@ RakeUp::ServerTask.new do |t|
10
11
t . server = :thin
11
12
end
12
13
13
- namespace :test do
14
- task :prepare do
15
- system ( %Q{mkdir -p "RestKit.xcworkspace/xcshareddata/xcschemes" && cp Tests/Schemes/*.xcscheme "RestKit.xcworkspace/xcshareddata/xcschemes/"} )
16
- end
14
+ XCTasks ::TestTask . new ( :test ) do |t |
15
+ t . workspace = 'RestKit.xcworkspace'
16
+ t . schemes_dir = 'Tests/Schemes'
17
+ t . runner = :xcpretty
18
+ t . actions = %w{ test }
17
19
18
- desc "Run the unit tests for iOS"
19
- task :ios => :prepare do
20
- $ios_success = system ( "xctool -workspace RestKit.xcworkspace -scheme RestKitTests -sdk iphonesimulator test -test-sdk iphonesimulator ONLY_ACTIVE_ARCH=NO" )
20
+ t . subtask ( ios : 'RestKitTests' ) do |s |
21
+ s . sdk = :iphonesimulator
21
22
end
22
23
23
- desc "Run the unit tests for OS X"
24
- task :osx => :prepare do
25
- $osx_success = system ( "xctool -workspace RestKit.xcworkspace -scheme RestKitFrameworkTests -sdk macosx test -test-sdk macosx" )
24
+ t . subtask ( osx : 'RestKitFrameworkTests' ) do |s |
25
+ s . sdk = :macosx
26
26
end
27
-
27
+ end
28
+
29
+ task default : 'test'
30
+
31
+ namespace :test do
28
32
# Provides validation that RestKit continues to build without Core Data. This requires conditional compilation that is error prone
29
33
task :building_without_core_data do
30
34
system ( "cd Examples/RKTwitter && pod install" )
31
35
system ( "xctool -workspace Examples/RKTwitter/RKTwitter.xcworkspace -scheme RKTwitterCocoaPods -sdk iphonesimulator clean build ONLY_ACTIVE_ARCH=NO" )
32
36
end
33
37
end
34
38
35
- desc 'Run all the RestKit tests'
36
- task :test => [ 'test:ios' , 'test:osx' ] do
37
- puts "\033 [0;31m!! iOS unit tests failed" unless $ios_success
38
- puts "\033 [0;31m!! OS X unit tests failed" unless $osx_success
39
- if $ios_success && $osx_success
40
- puts "\033 [0;32m** All tests executed successfully"
41
- else
42
- exit ( -1 )
43
- end
44
- end
45
-
46
39
task :default => [ "server:autostart" , :test , "server:autostop" ]
47
40
48
41
def restkit_version
0 commit comments