2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Projects::ForksCountService, :use_clean_rails_memory_store_caching do
|
2019-12-04 20:38:33 +05:30
|
|
|
let(:project) { build(:project) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
subject { described_class.new(project) }
|
|
|
|
|
|
|
|
it_behaves_like 'a counter caching service'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe '#count' do
|
|
|
|
it 'returns the number of forks' do
|
2019-12-04 20:38:33 +05:30
|
|
|
allow(subject).to receive(:uncached_count).and_return(1)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
expect(subject.count).to eq(1)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|