Commit dd4b7897 authored by Yorick Peterse's avatar Yorick Peterse

Added tests for Repository#build_cache

parent 3d7feeed
......@@ -780,4 +780,34 @@ describe Repository, models: true do
end
end
end
describe '#build_cache' do
let(:cache) { repository.send(:cache) }
it 'builds the caches if they do not already exist' do
expect(cache).to receive(:exist?).
exactly(repository.cache_keys.length).
times.
and_return(false)
repository.cache_keys.each do |key|
expect(repository).to receive(key)
end
repository.build_cache
end
it 'does not build any caches that already exist' do
expect(cache).to receive(:exist?).
exactly(repository.cache_keys.length).
times.
and_return(true)
repository.cache_keys.each do |key|
expect(repository).to_not receive(key)
end
repository.build_cache
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