Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-22 12:34:46 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-09-22 12:36:43 +0300
commitb0ce4ca11012388b1e4fbc1d928cbf4c0da66104 (patch)
treea102ce325327fd255159ca769f07d5e01dc7352c /spec/models/merge_request_diff_spec.rb
parent4ed23a3a5700f52236a676559203d56e6a3d0835 (diff)
Add test for MergeRequestDiff#commits_sha, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6470#note_15856755
Diffstat (limited to 'spec/models/merge_request_diff_spec.rb')
-rw-r--r--spec/models/merge_request_diff_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb
index e5b185dc3f6..530a7def553 100644
--- a/spec/models/merge_request_diff_spec.rb
+++ b/spec/models/merge_request_diff_spec.rb
@@ -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