Add test for caching nil status

This commit is contained in:
Matija Čupić 2018-10-26 20:06:34 +02:00
parent 0079fa19ce
commit 77cfdb0aea
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
1 changed files with 15 additions and 0 deletions

View File

@ -282,6 +282,21 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
expect(pipeline_status.status).to eq(status)
expect(pipeline_status.ref).to eq(ref)
end
context 'when status is empty string' do
before do
Gitlab::Redis::Cache.with do |redis|
redis.mapped_hmset(cache_key,
{ sha: sha, status: '', ref: ref })
end
end
it 'reads the status as nil' do
pipeline_status.load_from_cache
expect(pipeline_status.status).to eq(nil)
end
end
end
describe '#has_cache?' do