diff options
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 215f83adf5d..e1d903a40cf 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -418,46 +418,31 @@ RSpec.describe Repository do end describe '#new_commits' do - shared_examples '#new_commits' do - let_it_be(:project) { create(:project, :repository) } - - let(:repository) { project.repository } - - subject { repository.new_commits(rev, allow_quarantine: allow_quarantine) } - - context 'when there are no new commits' do - let(:rev) { repository.commit.id } + let_it_be(:project) { create(:project, :repository) } - it 'returns an empty array' do - expect(subject).to eq([]) - end - end + let(:repository) { project.repository } - context 'when new commits are found' do - let(:branch) { 'orphaned-branch' } - let!(:rev) { repository.commit(branch).id } - let(:allow_quarantine) { false } + subject { repository.new_commits(rev) } - it 'returns the commits' do - repository.delete_branch(branch) + context 'when there are no new commits' do + let(:rev) { repository.commit.id } - expect(subject).not_to be_empty - expect(subject).to all( be_a(::Commit) ) - expect(subject.size).to eq(1) - end + it 'returns an empty array' do + expect(subject).to eq([]) end end - context 'with quarantine' do - let(:allow_quarantine) { true } + context 'when new commits are found' do + let(:branch) { 'orphaned-branch' } + let!(:rev) { repository.commit(branch).id } - it_behaves_like '#new_commits' - end - - context 'without quarantine' do - let(:allow_quarantine) { false } + it 'returns the commits' do + repository.delete_branch(branch) - it_behaves_like '#new_commits' + expect(subject).not_to be_empty + expect(subject).to all( be_a(::Commit) ) + expect(subject.size).to eq(1) + end end end |