Commit 35a5cf56 authored by Marius Rackwitz's avatar Marius Rackwitz

[Cache] Recognize incomplete cache for released pods

parent ffa8b8a6
...@@ -77,8 +77,9 @@ module Pod ...@@ -77,8 +77,9 @@ module Pod
# #
def cached_pod(request) def cached_pod(request)
path = path_for_pod(request) path = path_for_pod(request)
spec_path = path_for_spec(request)
spec = request.spec || cached_spec(request) spec = request.spec || cached_spec(request)
return unless spec && path.directory? return unless spec && path.directory? && spec_path.file?
Response.new(path, spec, request.params) Response.new(path, spec, request.params)
end end
......
...@@ -74,6 +74,35 @@ module Pod ...@@ -74,6 +74,35 @@ module Pod
end end
end end
describe 'when the cache is incomplete' do
before do
[@request, @unreleased_request].each do |request|
path_for_pod = @cache.send(:path_for_pod, request)
path_for_pod.mkpath
Dir.chdir(path_for_pod) do
FileUtils.mkdir_p 'Classes'
File.open('Classes/a.m', 'w') {}
end
end
end
describe 'when downloading a released pod' do
it 'does download the source' do
Downloader::Git.any_instance.expects(:download).never
@cache.expects(:uncached_pod).once
@cache.download_pod(@request)
end
end
describe 'when downloading an unreleased pod' do
it 'does download the source' do
Downloader::Git.any_instance.expects(:download).never
@cache.expects(:uncached_pod).once
@cache.download_pod(@unreleased_request)
end
end
end
describe 'when the download is cached' do describe 'when the download is cached' do
before do before do
[@request, @unreleased_request].each do |request| [@request, @unreleased_request].each do |request|
......
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