diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-23 18:51:55 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-02-24 11:28:19 +0300 |
commit | 40d7c13dd63639149af7dec476f9be84653d28da (patch) | |
tree | fc50bed51437e6448f00e8cddba9be62e7fed5ea /spec | |
parent | f948c2f4ec03c544a1453714189599d02bcd99e8 (diff) |
Merge branch 'fix-mr-size-with-over-100-files' into 'master'
Fix MR changes tab size count
Closes #27563
See merge request !9091
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/merge_request_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 861426acbc3..d90577e1a84 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -209,6 +209,50 @@ describe MergeRequest, models: true do end end + describe '#diff_size' do + let(:merge_request) do + build(:merge_request, source_branch: 'expand-collapse-files', target_branch: 'master') + end + + context 'when there are MR diffs' do + before do + merge_request.save + end + + it 'returns the correct count' do + expect(merge_request.diff_size).to eq(105) + end + + it 'does not perform highlighting' do + expect(Gitlab::Diff::Highlight).not_to receive(:new) + + merge_request.diff_size + end + end + + context 'when there are no MR diffs' do + before do + merge_request.compare = CompareService.new( + merge_request.source_project, + merge_request.source_branch + ).execute( + merge_request.target_project, + merge_request.target_branch + ) + end + + it 'returns the correct count' do + expect(merge_request.diff_size).to eq(105) + end + + it 'does not perform highlighting' do + expect(Gitlab::Diff::Highlight).not_to receive(:new) + + merge_request.diff_size + end + end + end + describe "#related_notes" do let!(:merge_request) { create(:merge_request) } |