Skip to content

Commit

Permalink
Merge pull request #383 from dnkoutso/test_specs_api
Browse files Browse the repository at this point in the history
Handle :testspecs DSL for pod dependencies
  • Loading branch information
dnkoutso authored Jun 9, 2017
2 parents 7542753 + 939116c commit f554509
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/cocoapods-core/podfile/target_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -868,11 +868,18 @@ def parse_subspecs(name, requirements)
return false unless options.is_a?(Hash)

subspecs = options.delete(:subspecs)
test_specs = options.delete(:testspecs)

subspecs.each do |ss|
store_pod("#{name}/#{ss}", *requirements.dup)
end if subspecs

test_specs.each do |ss|
store_pod("#{name}/#{ss}", *requirements.dup)
end if test_specs

requirements.pop if options.empty?
!subspecs.nil?
!subspecs.nil? || !test_specs.nil?
end

#-----------------------------------------------------------------------#
Expand Down
16 changes: 16 additions & 0 deletions spec/podfile/target_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@ module Pod
@parent.dependencies.map(&:name).sort.should == %w(RestKit/Networking)
end

it 'allows depending on testspecs' do
@parent.store_pod('RestKit', :testspecs => %w(Tests))
@parent.dependencies.map(&:name).sort.should == %w(RestKit/Tests)
end

it 'allows depending on both subspecs and testspecs' do
@parent.store_pod('RestKit', :subspecs => %w(Networking))
@parent.store_pod('RestKit', :testspecs => %w(Tests))
@parent.dependencies.map(&:name).sort.should == %w(RestKit/Networking RestKit/Tests)
end

it 'allows depending on both subspecs and testspecs in chaining' do
@parent.store_pod('RestKit', :subspecs => %w(Networking), :testspecs => %w(Tests))
@parent.dependencies.map(&:name).sort.should == %w(RestKit/Networking RestKit/Tests)
end

#--------------------------------------#

it "doesn't inhibit warnings per pod by default" do
Expand Down

0 comments on commit f554509

Please sign in to comment.