diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-10-16 13:21:16 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-11-09 16:56:48 -0200 |
commit | f9b4130bb75adf33fbf2f74fb2662f09d073bd6f (patch) | |
tree | e6734e431b82d518b271218e620c6efec1b4c9bf /spec/controllers | |
parent | 5b270431399ca14198d7684c1855de04ee8aec5e (diff) | |
download | gitlab-ce-f9b4130bb75adf33fbf2f74fb2662f09d073bd6f.tar.gz |
Comment on any expanded diff line on MRsosw-comment-on-any-line-on-diffs-w-feature-flag
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/blob_controller_spec.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 28f7e4634a5..74771abde71 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -141,6 +141,28 @@ describe Projects::BlobController do expect(lines.first).to have_key('rich_text') end + context 'comment in any diff line feature flag' do + it 'renders context lines when feature disabled' do + stub_feature_flags(comment_in_any_diff_line: false) + + do_get(since: 1, to: 5, offset: 10, from_merge_request: true) + lines = JSON.parse(response.body) + all_context = lines.all? { |line| line['type'] == 'context' } + + expect(all_context).to be(true) + end + + it 'renders unchanged lines when feature enabled' do + stub_feature_flags(comment_in_any_diff_line: true) + + do_get(since: 1, to: 5, offset: 10, from_merge_request: true) + lines = JSON.parse(response.body) + all_unchanged = lines.all? { |line| line['type'].nil? } + + expect(all_unchanged).to be(true) + end + end + context 'when rendering match lines' do it 'adds top match line when "since" is less than 1' do do_get(since: 5, to: 10, offset: 10, from_merge_request: true) @@ -157,7 +179,7 @@ describe Projects::BlobController do match_line = JSON.parse(response.body).first - expect(match_line['type']).to eq('context') + expect(match_line['type']).to be_nil end it 'adds bottom match line when "t"o is less than blob size' do @@ -177,7 +199,7 @@ describe Projects::BlobController do match_line = JSON.parse(response.body).last - expect(match_line['type']).to eq('context') + expect(match_line['type']).to be_nil end end end |