summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-01-04 23:33:17 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-01-04 23:33:17 +0100
commit6fb4a533b74c861a1e533604da462efb6d309de0 (patch)
tree053fdbd23a891e175d94cb2bb01da6652296366c
parent0f137d8e9cc4b44ab11c549860bf27e7244ad09d (diff)
downloadgitlab-ce-6fb4a533b74c861a1e533604da462efb6d309de0.tar.gz
Add feature test for resetting runner caches
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index b87b47d0e1a..69a836292fc 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -545,6 +545,42 @@ describe 'Pipelines', :js do
end
end
end
+
+ describe 'Reset runner caches' do
+ let(:project) { create(:project, :repository) }
+
+ before do
+ create(:ci_empty_pipeline, status: 'success', project: project, sha: project.commit.id, ref: 'master')
+ project.team << [user, :master]
+ visit project_pipelines_path(project)
+ end
+
+ it 'has a clear caches button' do
+ expect(page).to have_link 'Clear runner caches'
+ end
+
+ describe 'user clicks the button' do
+ subject { click_link 'Clear runner caches' }
+
+ context 'when project already has jobs_cache_index' do
+ before do
+ project.update_attributes(jobs_cache_index: 1)
+ end
+
+ it 'increments jobs_cache_index' do
+ expect { subject }.to change { project.reload.jobs_cache_index }.by(1)
+ expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
+ end
+ end
+
+ context 'when project does not have jobs_cache_index' do
+ it 'sets jobs_cache_index to 1' do
+ expect { subject }.to change { project.reload.jobs_cache_index }.from(nil).to(1)
+ expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.'
+ end
+ end
+ end
+ end
end
context 'when user is not logged in' do