From d9502fa528888307940c47ce27ea00f33f3d0c46 Mon Sep 17 00:00:00 2001 From: Justin Martin Date: Mon, 28 Aug 2017 17:27:32 -0700 Subject: [PATCH] Fix requirements cloning for `:testspecs` --- CHANGELOG.md | 4 ++++ lib/cocoapods-core/podfile/target_definition.rb | 3 ++- spec/podfile/target_definition_spec.rb | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f68a5c278..fe8e760c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ##### Enhancements +* Fix requirements cloning for `:testspecs` + [Justin Martin](https://github.com/justinseanmartin) + [#401](https://github.com/CocoaPods/Core/pull/401) + * Add Podfile DSL for `script_phase` [Dimitris Koutsogiorgas](https://github.com/dnkoutso) [#389](https://github.com/CocoaPods/Core/pull/389) diff --git a/lib/cocoapods-core/podfile/target_definition.rb b/lib/cocoapods-core/podfile/target_definition.rb index 942e235a2..f553b47d1 100644 --- a/lib/cocoapods-core/podfile/target_definition.rb +++ b/lib/cocoapods-core/podfile/target_definition.rb @@ -921,7 +921,8 @@ def parse_subspecs(name, requirements) end if subspecs test_specs.each do |ss| - store_pod("#{name}/#{ss}", *requirements.dup) + requirements_copy = requirements.map(&:dup) + store_pod("#{name}/#{ss}", *requirements_copy) end if test_specs requirements.pop if options.empty? diff --git a/spec/podfile/target_definition_spec.rb b/spec/podfile/target_definition_spec.rb index 0020bb4c4..6f7a2a5bf 100644 --- a/spec/podfile/target_definition_spec.rb +++ b/spec/podfile/target_definition_spec.rb @@ -409,6 +409,15 @@ module Pod @child.all_whitelisted_configurations.sort.should == %w(Debug Release) end + it 'whitelistes pod configurations with testspecs' do + @parent.build_configurations = { 'Debug' => :debug, 'Release' => :release } + @parent.store_pod('RestKit', :testspecs => %w(Tests), :configuration => 'Debug') + @parent.should.pod_whitelisted_for_configuration?('RestKit', 'Debug') + @parent.should.pod_whitelisted_for_configuration?('RestKit/Tests', 'Debug') + @parent.should.not.pod_whitelisted_for_configuration?('RestKit', 'Release') + @parent.should.not.pod_whitelisted_for_configuration?('RestKit/Tests', 'Release') + end + #--------------------------------------# it 'returns its platform' do