Commit 7b2fc05a authored by Matija Čupić's avatar Matija Čupić

Implement ResetProjectCacheService

parent 1e0aa2ae
class ResetProjectCacheService < BaseService
def execute
@project.increment!(:cache_index)
end
end
......@@ -6,7 +6,23 @@ describe ResetProjectCacheService do
subject { described_class.new(project, user).execute }
it "resets project cache" do
fail
context 'when project cache_index is nil' do
before do
project.cache_index = nil
end
it 'sets project cache_index to one' do
expect { subject }.to change { project.reload.cache_index }.from(nil).to(1)
end
end
context 'when project cache_index is a numeric value' do
before do
project.update_attributes(cache_index: 1)
end
it 'increments project cache index' do
expect { subject }.to change { project.reload.cache_index }.by(1)
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