Add test for MergeRequestDiff#commits_sha, feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6470#note_15856755
This commit is contained in:
Lin Jen-Shin 2016-09-22 17:34:46 +08:00
parent 4ed23a3a57
commit b0ce4ca110

View file

@ -64,5 +64,27 @@ describe MergeRequestDiff, models: true do
end
end
end
describe '#commits_sha' do
shared_examples 'returning all commits SHA' do
it 'returns all commits SHA' do
commits_sha = subject.commits_sha
expect(commits_sha).to eq(subject.commits.map(&:sha))
end
end
context 'when commits were loaded' do
before do
subject.commits
end
it_behaves_like 'returning all commits SHA'
end
context 'when commits were not loaded' do
it_behaves_like 'returning all commits SHA'
end
end
end
end