diff --git a/lib/cocoapods/validator.rb b/lib/cocoapods/validator.rb index 3fe07cee74..52a1e1c3c0 100644 --- a/lib/cocoapods/validator.rb +++ b/lib/cocoapods/validator.rb @@ -208,8 +208,11 @@ def install_pod installer = Installer.new(sandbox, podfile) installer.install! - file_accessors = installer.aggregate_targets.first.pod_targets.first.file_accessors - @file_accessor = file_accessors.find { |accessor| accessor.spec == spec } + file_accessors = installer.aggregate_targets.map do |target| + target.pod_targets.map(&:file_accessors) + end.flatten + + @file_accessor = file_accessors.find { |accessor| accessor.spec.root.name == spec.root.name } config.silent end diff --git a/spec/unit/validator_spec.rb b/spec/unit/validator_spec.rb index 43fa448ec8..2715e5d365 100644 --- a/spec/unit/validator_spec.rb +++ b/spec/unit/validator_spec.rb @@ -64,6 +64,18 @@ def podspec_path validator.results.map(&:to_s).first.should.match /source_files.*did not match/ validator.result_type.should == :error end + + it "validates a podspec with dependencies" do + podspec = stub_podspec(/s.name.*$/, 's.name = "ZKit"') + podspec.gsub! /s.requires_arc/, "s.dependency 'SBJson', '~> 3.2'\n s.requires_arc" + file = write_podspec(podspec, "ZKit.podspec") + + spec = Specification.from_file(file) + validator = Validator.new(spec) + validator.validate + validator.results.map(&:to_s).first.should.match /should match the name/ + validator.validated?.should.be.false + end #--------------------------------------#