aff5c9f3e5
This is an ID-less table with just three columns: an association to the merge request diff the commit belongs to, the relative order of the commit within the merge request diff, and the commit SHA itself. Previously we stored much more information about the commits, so that we could display them even when they were deleted from the repo. Since 8.0, we ensure that those commits are kept around for as long as the target repo itself is, so we don't need to duplicate that data in the database.
15 lines
501 B
Ruby
15 lines
501 B
Ruby
require 'rails_helper'
|
|
|
|
describe MergeRequestDiffCommit, type: :model do
|
|
let(:merge_request) { create(:merge_request) }
|
|
subject { merge_request.commits.first }
|
|
|
|
describe '#to_hash' do
|
|
it 'returns the same results as Commit#to_hash, except for parent_ids' do
|
|
commit_from_repo = merge_request.project.repository.commit(subject.sha)
|
|
commit_from_repo_hash = commit_from_repo.to_hash.merge(parent_ids: [])
|
|
|
|
expect(subject.to_hash).to eq(commit_from_repo_hash)
|
|
end
|
|
end
|
|
end
|