a0b14c40dc
Notes call `#after_note_created` and `#after_note_destroyed` on their noteable in callbacks, so the noteable can perform tasks particular to them, like cache expiry. This is in preparation of the EE-specific class `DesignManagement::Design` clearing its `user_notes_count` cache when its note are created or destroyed. Refactoring Rspec behaviour testing of a counter caching service into a shared example. https://gitlab.com/gitlab-org/gitlab-ee/issues/13353
18 lines
442 B
Ruby
18 lines
442 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe Projects::ForksCountService, :use_clean_rails_memory_store_caching do
|
|
let(:project) { build(:project) }
|
|
subject { described_class.new(project) }
|
|
|
|
it_behaves_like 'a counter caching service'
|
|
|
|
describe '#count' do
|
|
it 'returns the number of forks' do
|
|
allow(subject).to receive(:uncached_count).and_return(1)
|
|
|
|
expect(subject.count).to eq(1)
|
|
end
|
|
end
|
|
end
|