diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-30 15:32:09 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-03 14:47:21 -0500 |
commit | f8fabfcc6ff6be4e20e3cc9353be86b7cf53af47 (patch) | |
tree | 15816b09ecdebbd4eb797195b90cb4f46b6819c4 /spec/models/legacy_diff_discussion_spec.rb | |
parent | 185fd98fd4cb8f920558aea3795c4e1774cd39f5 (diff) | |
download | gitlab-ce-f8fabfcc6ff6be4e20e3cc9353be86b7cf53af47.tar.gz |
Allow commenting on older versions of the diff and comparisons between diff versionsdm-link-discussion-to-outdated-diff
Diffstat (limited to 'spec/models/legacy_diff_discussion_spec.rb')
-rw-r--r-- | spec/models/legacy_diff_discussion_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/legacy_diff_discussion_spec.rb b/spec/models/legacy_diff_discussion_spec.rb index 153e757a0ef..6eb4a2aaf39 100644 --- a/spec/models/legacy_diff_discussion_spec.rb +++ b/spec/models/legacy_diff_discussion_spec.rb @@ -8,4 +8,26 @@ describe LegacyDiffDiscussion, models: true do expect(subject.reply_attributes[:line_code]).to eq(subject.line_code) end end + + describe '#merge_request_version_params' do + context 'when the discussion is active' do + before do + allow(subject).to receive(:active?).and_return(true) + end + + it 'returns an empty hash, which will end up showing the latest version' do + expect(subject.merge_request_version_params).to eq({}) + end + end + + context 'when the discussion is outdated' do + before do + allow(subject).to receive(:active?).and_return(false) + end + + it 'returns nil' do + expect(subject.merge_request_version_params).to be_nil + end + end + end end |