Commit 0407b396 authored by Boris Bügling's avatar Boris Bügling

Merge pull request #5410 from CocoaPods/seg-init-use-product-type

[Init] Use target product type to determine test targets
parents 9462f9f7 c9116172
......@@ -38,10 +38,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Marc Boquet](https://github.com/marcboquet)
[#5294](https://github.com/CocoaPods/CocoaPods/issues/5294)
* Guarding from crash if pod lib create has a + character in the name.
* Guarding from crash if pod lib create has a + character in the name.
[William Entriken](https://github.com/fulldecent)
[CocoaPods/pod-template#69](https://github.com/CocoaPods/pod-template/issues/69)
* Use target product types to determine whether a target is a test target when
running `pod init`.
[Samuel Giddins](https://github.com/segiddins)
[#5378](https://github.com/CocoaPods/CocoaPods/issues/5378)
## 1.0.0 (2016-05-10)
......
......@@ -24,7 +24,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 480e2f99e5e9315b8032854a9530aa500761e138
revision: cd03f259381c2b6317e60f088adff6b6e2b01d68
branch: master
specs:
xcodeproj (1.0.0)
......
......@@ -63,7 +63,7 @@ module Pod
# Split out the targets into app and test targets
test_targets, app_targets = project.native_targets.
sort_by { |t| t.name.downcase }.
partition { |t| t.name =~ /test/i }
partition(&:test_target_type?)
app_targets.each do |app_target|
test_targets_for_app = test_targets.select do |target|
......
......@@ -90,8 +90,8 @@ module Pod
Dir.chdir(temporary_directory) do
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, 'App', :ios)
project.new_target(:application, 'AppTests', :ios)
project.new_target(:application, 'AppFeatureTests', :ios)
project.new_target(:unit_test_bundle, 'AppTests', :ios)
project.new_target(:ui_test_bundle, 'AppFeatureTests', :ios)
project.new_target(:application, 'Swifty App', :osx, nil, nil, :swift)
project.save
......@@ -142,7 +142,7 @@ module Pod
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, 'App', :ios)
project.new_target(:application, 'AppTests', :ios)
project.new_target(:unit_test_bundle, 'AppTests', :ios)
project.save
run_command('init')
......@@ -152,6 +152,26 @@ module Pod
end
end
it 'does not treat non-test targets as test targets' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_templates_dir.mkpath
config.stubs(:templates_dir).returns(tmp_templates_dir)
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
project.new_target(:application, 'Test', :ios)
project.new_target(:application, 'Test Test Test', :ios)
project.save
run_command('init')
config.podfile.target_definitions['Test'].dependencies.should.be.empty
config.podfile.target_definitions['Test Test Test'].dependencies.should.be.empty
end
end
it 'does not include default test pods if there are no test targets' do
Dir.chdir(temporary_directory) do
tmp_templates_dir = Pathname.pwd + 'templates_dir'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment