diff options
author | Hiroyuki Sato <sathiroyuki@gmail.com> | 2018-01-12 23:38:36 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-01-12 23:38:36 +0300 |
commit | a7d26f00c35b945199d40332349f463043ae6122 (patch) | |
tree | 7b76a2e305e4a4f81f61271337c9731d0d50e16f /spec/models/merge_request_diff_spec.rb | |
parent | 1b5f179557d03683f92ed3af3d357df056cc8ece (diff) |
Display related merge requests in commit detail page
Diffstat (limited to 'spec/models/merge_request_diff_spec.rb')
-rw-r--r-- | spec/models/merge_request_diff_spec.rb | 22 |
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 d556004eccf..b4249d72fc8 100644 --- a/spec/models/merge_request_diff_spec.rb +++ b/spec/models/merge_request_diff_spec.rb @@ -15,6 +15,28 @@ describe MergeRequestDiff do it { expect(subject.start_commit_sha).to eq('0b4bc9a49b562e85de7cc9e834518ea6828729b9') } end + describe '.by_commit_sha' do + subject(:by_commit_sha) { described_class.by_commit_sha(sha) } + + let!(:merge_request) { create(:merge_request, :with_diffs) } + + context 'with sha contained in' do + let(:sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' } + + it 'returns merge request diffs' do + expect(by_commit_sha).to eq([merge_request.merge_request_diff]) + end + end + + context 'with sha not contained in' do + let(:sha) { 'b83d6e3' } + + it 'returns empty result' do + expect(by_commit_sha).to be_empty + end + end + end + describe '#latest' do let!(:mr) { create(:merge_request, :with_diffs) } let!(:first_diff) { mr.merge_request_diff } |