Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix requirements cloning for :testspecs #401

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion lib/cocoapods-core/podfile/target_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was basically returning a shallow clone of the requirements and when using test specs we are actually adding a pod not overriding like it happens for when using :subspecs.

The shallow clone caused the store_pod to remove the configuration when parsing the test spec and then the parent had 0 configuration causing an inconsistency between the parent configurations and the test spec configuration.

end if test_specs

requirements.pop if options.empty?
Expand Down
9 changes: 9 additions & 0 deletions spec/podfile/target_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,15 @@ module Pod
@child.all_whitelisted_configurations.sort.should == %w(Debug Release)
end

it 'whitelistes pod configurations with testspecs' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh: whitelists

@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
Expand Down