summaryrefslogtreecommitdiff
path: root/spec/models/commit_range_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/commit_range_spec.rb')
-rw-r--r--spec/models/commit_range_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/commit_range_spec.rb b/spec/models/commit_range_spec.rb
index 1cf51d8bab3..6bc496414a3 100644
--- a/spec/models/commit_range_spec.rb
+++ b/spec/models/commit_range_spec.rb
@@ -145,4 +145,27 @@ describe CommitRange, models: true do
end
end
end
+
+ describe '#has_been_reverted?' do
+ it 'returns true if the commit has been reverted' do
+ issue = create(:issue)
+
+ create(:note_on_issue,
+ noteable_id: issue.id,
+ system: true,
+ note: commit1.revert_description)
+
+ expect_any_instance_of(Commit).to receive(:reverts_commit?).
+ with(commit1).
+ and_return(true)
+
+ expect(commit1.has_been_reverted?(nil, issue)).to eq(true)
+ end
+
+ it 'returns false a commit has not been reverted' do
+ issue = create(:issue)
+
+ expect(commit1.has_been_reverted?(nil, issue)).to eq(false)
+ end
+ end
end