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:
authorDouwe Maan <douwe@selenight.nl>2017-04-30 23:32:09 +0300
committerDouwe Maan <douwe@selenight.nl>2017-05-03 22:47:21 +0300
commitf8fabfcc6ff6be4e20e3cc9353be86b7cf53af47 (patch)
tree15816b09ecdebbd4eb797195b90cb4f46b6819c4 /spec/models/legacy_diff_discussion_spec.rb
parent185fd98fd4cb8f920558aea3795c4e1774cd39f5 (diff)
Allow commenting on older versions of the diff and comparisons between diff versions
Diffstat (limited to 'spec/models/legacy_diff_discussion_spec.rb')
-rw-r--r--spec/models/legacy_diff_discussion_spec.rb22
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