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