2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe ResetProjectCacheService do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
subject { described_class.new(project, user).execute }
|
|
|
|
|
|
|
|
context 'when project cache_index is nil' do
|
|
|
|
before do
|
|
|
|
project.jobs_cache_index = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets project cache_index to one' do
|
|
|
|
expect { subject }.to change { project.reload.jobs_cache_index }.from(nil).to(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when project cache_index is a numeric value' do
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.update(jobs_cache_index: 1)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'increments project cache index' do
|
|
|
|
expect { subject }.to change { project.reload.jobs_cache_index }.by(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|