diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/finders/context_commits_finder_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/finders/context_commits_finder_spec.rb')
-rw-r--r-- | spec/finders/context_commits_finder_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/finders/context_commits_finder_spec.rb b/spec/finders/context_commits_finder_spec.rb index 95c685aea24..c22675bc67d 100644 --- a/spec/finders/context_commits_finder_spec.rb +++ b/spec/finders/context_commits_finder_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe ContextCommitsFinder do describe "#execute" do let(:project) { create(:project, :repository) } - let(:merge_request) { create(:merge_request) } + let(:merge_request) { create(:merge_request, source_branch: 'feature', target_branch: 'master') } let(:commit) { create(:commit, id: '6d394385cf567f80a8fd85055db1ab4c5295806f') } it 'filters commits by valid sha/commit message' do @@ -24,5 +24,29 @@ RSpec.describe ContextCommitsFinder do expect(commits).to be_empty end + + it 'returns commits based in author filter' do + params = { search: 'test text', author: 'Job van der Voort' } + commits = described_class.new(project, merge_request, params).execute + + expect(commits.length).to eq(1) + expect(commits[0].id).to eq('b83d6e391c22777fca1ed3012fce84f633d7fed0') + end + + it 'returns commits based in before filter' do + params = { search: 'test text', committed_before: 1474828200 } + commits = described_class.new(project, merge_request, params).execute + + expect(commits.length).to eq(1) + expect(commits[0].id).to eq('498214de67004b1da3d820901307bed2a68a8ef6') + end + + it 'returns commits based in after filter' do + params = { search: 'test text', committed_after: 1474828200 } + commits = described_class.new(project, merge_request, params).execute + + expect(commits.length).to eq(1) + expect(commits[0].id).to eq('b83d6e391c22777fca1ed3012fce84f633d7fed0') + end end end |