summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/merge_request_spec.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 310f806e3d3..656753da5f1 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -115,8 +115,24 @@ describe MergeRequest do
let(:multiline_commits) { subject.commits.select(&is_multiline) }
let(:singleline_commits) { subject.commits.reject(&is_multiline) }
- it 'returns the oldest multiline commit message' do
- expect(subject.default_squash_commit_message).to eq(multiline_commits.last.message)
+ context 'when the total number of commits is safe' do
+ it 'returns the oldest multiline commit message' do
+ expect(subject.default_squash_commit_message).to eq(multiline_commits.last.message)
+ end
+ end
+
+ context 'when the total number of commits is big' do
+ let(:safe_number) { 20 }
+
+ before do
+ stub_const('MergeRequestDiff::COMMITS_SAFE_SIZE', safe_number)
+ end
+
+ it 'returns the oldest multiline commit message from safe number of commits' do
+ expect(subject.default_squash_commit_message).to eq(
+ "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n"
+ )
+ end
end
it 'returns the merge request title if there are no multiline commits' do