diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-21 15:10:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-21 15:10:22 +0300 |
commit | eb8836dea46945d5adf20be26efde222b73e17f9 (patch) | |
tree | bdf2cceb9b16c5f311728642b471a9f469d83f0b /spec/models/commit_spec.rb | |
parent | 9bb53582af31891f10f3410d163f4653b572b768 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index cfa87b3e39e..47212f54df6 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -750,6 +750,27 @@ eos end end + describe '#reverting_commit' do + let(:user) { create(:user) } + let(:issue) { create(:issue, author: user, project: project) } + + it 'returns the reverting commit' do + create(:note_on_issue, + noteable: issue, + system: true, + note: commit.revert_description(user), + project: issue.project) + + expect_next_instance_of(Commit) do |revert_commit| + expect(revert_commit).to receive(:reverts_commit?) + .with(commit, user) + .and_return(true) + end + + expect(commit.reverting_commit(user, issue.notes_with_associations)).to eq(commit) + end + end + describe '#has_been_reverted?' do let(:user) { create(:user) } let(:issue) { create(:issue, author: user, project: project) } |