diff options
author | Robert Speicher <robert@gitlab.com> | 2017-08-08 00:33:45 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-08-08 00:33:45 +0300 |
commit | 475f41acd4a8e0666736d40feb4d8945cf2c306a (patch) | |
tree | 73288e5750c8a212ad5394a2fb0f7090237a6289 /spec | |
parent | 6085ce1352eee7b3e18b014f0f68719cae780da8 (diff) | |
parent | c0b41064ff1eb4c5465d3c2a9efa0a22b60c3f4c (diff) |
Merge branch 'feature/migrate-find-commits-by-message-to-gitaly' into 'master'
Migrate Repository#find_commits_by_message to Gitaly
Closes gitaly#443
See merge request !13268
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 4ddda5b638c..cfa77648338 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -234,19 +234,31 @@ describe Repository, models: true do end describe '#find_commits_by_message' do - it 'returns commits with messages containing a given string' do - commit_ids = repository.find_commits_by_message('submodule').map(&:id) + shared_examples 'finding commits by message' do + it 'returns commits with messages containing a given string' do + commit_ids = repository.find_commits_by_message('submodule').map(&:id) - expect(commit_ids).to include('5937ac0a7beb003549fc5fd26fc247adbce4a52e') - expect(commit_ids).to include('6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') - expect(commit_ids).to include('cfe32cf61b73a0d5e9f13e774abde7ff789b1660') - expect(commit_ids).not_to include('913c66a37b4a45b9769037c55c2d238bd0942d2e') + expect(commit_ids).to include( + '5937ac0a7beb003549fc5fd26fc247adbce4a52e', + '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9', + 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' + ) + expect(commit_ids).not_to include('913c66a37b4a45b9769037c55c2d238bd0942d2e') + end + + it 'is case insensitive' do + commit_ids = repository.find_commits_by_message('SUBMODULE').map(&:id) + + expect(commit_ids).to include('5937ac0a7beb003549fc5fd26fc247adbce4a52e') + end end - it 'is case insensitive' do - commit_ids = repository.find_commits_by_message('SUBMODULE').map(&:id) + context 'when Gitaly commits_by_message feature is enabled' do + it_behaves_like 'finding commits by message' + end - expect(commit_ids).to include('5937ac0a7beb003549fc5fd26fc247adbce4a52e') + context 'when Gitaly commits_by_message feature is disabled', skip_gitaly_mock: true do + it_behaves_like 'finding commits by message' end describe 'when storage is broken', broken_storage: true do |