Commit 4f166599 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #6571 from dnkoutso/error_regression

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