2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-14 09:22:09 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe Projects::ForksCountService, :use_clean_rails_memory_store_caching do
|
2019-08-27 16:50:26 -04:00
|
|
|
let(:project) { build(:project) }
|
2019-12-12 07:07:33 -05:00
|
|
|
|
2019-08-27 16:50:26 -04:00
|
|
|
subject { described_class.new(project) }
|
|
|
|
|
|
|
|
it_behaves_like 'a counter caching service'
|
|
|
|
|
2017-08-14 09:22:09 -04:00
|
|
|
describe '#count' do
|
|
|
|
it 'returns the number of forks' do
|
2019-08-27 16:50:26 -04:00
|
|
|
allow(subject).to receive(:uncached_count).and_return(1)
|
2017-08-14 09:22:09 -04:00
|
|
|
|
2019-08-27 16:50:26 -04:00
|
|
|
expect(subject.count).to eq(1)
|
2017-08-14 09:22:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|