Fix regression from #6457 to ensure a correct error message is given when a spec is not found.

parent 8df7c49a
...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Fix regression from #6457 to ensure a correct error message is given when a spec is not found.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6457](https://github.com/CocoaPods/CocoaPods/issues/6457)
* Provide a better error message if a podspec is found but cannot be parsed. * Provide a better error message if a podspec is found but cannot be parsed.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6457](https://github.com/CocoaPods/CocoaPods/issues/6457) [#6457](https://github.com/CocoaPods/CocoaPods/issues/6457)
......
...@@ -116,10 +116,12 @@ module Pod ...@@ -116,10 +116,12 @@ module Pod
rescue Pod::DSLError => e rescue Pod::DSLError => e
raise Informative, "Failed to load '#{name}' podspec: #{e.message}" raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
rescue => _ rescue => _
raise Informative, "Unable to find a specification for '#{name}'." raise Informative, "Failed to download '#{name}'."
end end
spec = download_result.spec spec = download_result.spec
raise Informative, "Unable to find a specification for '#{name}'." unless spec
store_podspec(sandbox, spec) store_podspec(sandbox, spec)
sandbox.store_pre_downloaded_pod(name) sandbox.store_pre_downloaded_pod(name)
sandbox.store_checkout_source(name, download_result.checkout_options) sandbox.store_checkout_source(name, download_result.checkout_options)
......
...@@ -36,6 +36,12 @@ module Pod ...@@ -36,6 +36,12 @@ module Pod
end end
end end
it 'raises a generic error if pre download fails' do
Downloader.stubs(:download).raises(Pod::Downloader::DownloaderError.new('Some generic exception'))
exception = lambda { @subject.send(:pre_download, config.sandbox) }.should.raise Informative
exception.message.should.include "Failed to download 'Reachability'"
end
it 'raises appropriate error if a DSLError when storing a podspec from string' do it 'raises appropriate error if a DSLError when storing a podspec from string' do
podspec = 'Pod::Spec.new do |s|; error; end' podspec = 'Pod::Spec.new do |s|; error; end'
should.raise(Informative) { @subject.send(:store_podspec, config.sandbox, podspec) }. should.raise(Informative) { @subject.send(:store_podspec, config.sandbox, podspec) }.
...@@ -51,10 +57,10 @@ module Pod ...@@ -51,10 +57,10 @@ module Pod
end end
it 'raises a generic error if a podspec was not found' do it 'raises a generic error if a podspec was not found' do
Downloader.stubs(:download).raises(Pod::Downloader::DownloaderError.new('Some generic exception')) download_result = stub(:spec => nil)
should.raise(Informative) do Downloader.stubs(:download).returns(download_result)
@subject.send(:pre_download, config.sandbox).message.should == "Unable to find a specification for 'Reachability'." exception = lambda { @subject.send(:pre_download, config.sandbox) }.should.raise Informative
end exception.message.should.include "Unable to find a specification for 'Reachability'."
end end
end end
......
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