summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb2
-rw-r--r--spec/tasks/cache/clear/redis_spec.rb19
2 files changed, 20 insertions, 1 deletions
diff --git a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
index 16704ff5e77..18658588a40 100644
--- a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
+++ b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
let!(:project) { create(:project, :repository) }
let(:pipeline_status) { described_class.new(project) }
- let(:cache_key) { "projects/#{project.id}/pipeline_status" }
+ let(:cache_key) { described_class.cache_key_for_project(project) }
describe '.load_for_project' do
it "loads the status" do
diff --git a/spec/tasks/cache/clear/redis_spec.rb b/spec/tasks/cache/clear/redis_spec.rb
new file mode 100644
index 00000000000..cca2b864e9b
--- /dev/null
+++ b/spec/tasks/cache/clear/redis_spec.rb
@@ -0,0 +1,19 @@
+require 'rake_helper'
+
+describe 'clearing redis cache' do
+ before do
+ Rake.application.rake_require 'tasks/cache'
+ end
+
+ describe 'clearing pipeline status cache' do
+ let(:pipeline_status) { create(:ci_pipeline).project.pipeline_status }
+
+ before do
+ allow(pipeline_status).to receive(:loaded).and_return(nil)
+ end
+
+ it 'clears pipeline status cache' do
+ expect { run_rake_task('cache:clear:redis') }.to change { pipeline_status.has_cache? }
+ end
+ end
+end