Commit 9604c967 authored by Thomas Randolph's avatar Thomas Randolph

Update all RSpec tests to allow the flagged features to work

When the backend for this feature flag was implemented,
everything was stubbed out to be false so it would pass.

The frontend work to integrate it has now flipped that, and all
the stubs should be removed.
parent 7af9c56a
...@@ -31,11 +31,8 @@ describe 'Merge request > Batch comments', :js do ...@@ -31,11 +31,8 @@ describe 'Merge request > Batch comments', :js do
end end
end end
it_behaves_like 'rendering a single diff version'
context 'Feature is enabled' do context 'Feature is enabled' do
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
stub_licensed_features(batch_comments: true) stub_licensed_features(batch_comments: true)
......
...@@ -11,7 +11,6 @@ describe 'Merge request > image review', :js do ...@@ -11,7 +11,6 @@ describe 'Merge request > image review', :js do
let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project, author: user) } let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project, author: user) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_licensed_features(batch_comments: true) stub_licensed_features(batch_comments: true)
sign_in(user) sign_in(user)
...@@ -24,8 +23,6 @@ describe 'Merge request > image review', :js do ...@@ -24,8 +23,6 @@ describe 'Merge request > image review', :js do
wait_for_requests wait_for_requests
end end
it_behaves_like 'rendering a single diff version'
it 'leaves review' do it 'leaves review' do
find('.js-add-image-diff-note-button', match: :first).click find('.js-add-image-diff-note-button', match: :first).click
......
...@@ -32,8 +32,6 @@ describe 'a maintainer edits files on a source-branch of an MR from a fork', :js ...@@ -32,8 +32,6 @@ describe 'a maintainer edits files on a source-branch of an MR from a fork', :js
wait_for_requests wait_for_requests
end end
it_behaves_like 'rendering a single diff version'
it 'mentions commits will go to the source branch' do it 'mentions commits will go to the source branch' do
expect(page).to have_content('Your changes can be committed to fix because a merge request is open.') expect(page).to have_content('Your changes can be committed to fix because a merge request is open.')
end end
......
...@@ -13,15 +13,12 @@ describe 'User comments on a diff', :js do ...@@ -13,15 +13,12 @@ describe 'User comments on a diff', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
visit(diffs_project_merge_request_path(project, merge_request)) visit(diffs_project_merge_request_path(project, merge_request))
end end
it_behaves_like 'rendering a single diff version'
context 'when viewing comments' do context 'when viewing comments' do
context 'when toggling inline comments' do context 'when toggling inline comments' do
context 'in a single file' do context 'in a single file' do
......
...@@ -9,7 +9,6 @@ describe 'Merge request > User creates image diff notes', :js do ...@@ -9,7 +9,6 @@ describe 'Merge request > User creates image diff notes', :js do
let(:user) { project.creator } let(:user) { project.creator }
before do before do
stub_feature_flags(single_mr_diff_view: false)
sign_in(user) sign_in(user)
# Stub helper to return any blob file as image from public app folder. # Stub helper to return any blob file as image from public app folder.
...@@ -18,8 +17,6 @@ describe 'Merge request > User creates image diff notes', :js do ...@@ -18,8 +17,6 @@ describe 'Merge request > User creates image diff notes', :js do
allow_any_instance_of(DiffHelper).to receive(:diff_file_old_blob_raw_url).and_return('/favicon.png') allow_any_instance_of(DiffHelper).to receive(:diff_file_old_blob_raw_url).and_return('/favicon.png')
end end
it_behaves_like 'rendering a single diff version'
context 'create commit diff notes' do context 'create commit diff notes' do
commit_id = '2f63565e7aac07bcdadb654e253078b727143ec4' commit_id = '2f63565e7aac07bcdadb654e253078b727143ec4'
......
...@@ -7,7 +7,6 @@ describe 'User expands diff', :js do ...@@ -7,7 +7,6 @@ describe 'User expands diff', :js do
let(:merge_request) { create(:merge_request, source_branch: 'expand-collapse-files', source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, source_branch: 'expand-collapse-files', source_project: project, target_project: project) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
allow(Gitlab::Git::Diff).to receive(:size_limit).and_return(100.kilobytes) allow(Gitlab::Git::Diff).to receive(:size_limit).and_return(100.kilobytes)
...@@ -18,8 +17,6 @@ describe 'User expands diff', :js do ...@@ -18,8 +17,6 @@ describe 'User expands diff', :js do
wait_for_requests wait_for_requests
end end
it_behaves_like 'rendering a single diff version'
it 'allows user to expand diff' do it 'allows user to expand diff' do
page.within find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9"]') do page.within find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9"]') do
click_link 'Click to expand it.' click_link 'Click to expand it.'
......
...@@ -14,15 +14,12 @@ describe 'Merge request > User posts diff notes', :js do ...@@ -14,15 +14,12 @@ describe 'Merge request > User posts diff notes', :js do
let(:test_note_comment) { 'this is a test note!' } let(:test_note_comment) { 'this is a test note!' }
before do before do
stub_feature_flags(single_mr_diff_view: false)
set_cookie('sidebar_collapsed', 'true') set_cookie('sidebar_collapsed', 'true')
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
end end
it_behaves_like 'rendering a single diff version'
context 'when hovering over a parallel view diff file' do context 'when hovering over a parallel view diff file' do
before do before do
visit diffs_project_merge_request_path(project, merge_request, view: 'parallel') visit diffs_project_merge_request_path(project, merge_request, view: 'parallel')
......
...@@ -9,7 +9,6 @@ describe 'Merge request > User resolves conflicts', :js do ...@@ -9,7 +9,6 @@ describe 'Merge request > User resolves conflicts', :js do
before do before do
# In order to have the diffs collapsed, we need to disable the increase feature # In order to have the diffs collapsed, we need to disable the increase feature
stub_feature_flags(gitlab_git_diff_size_limit_increase: false) stub_feature_flags(gitlab_git_diff_size_limit_increase: false)
stub_feature_flags(single_mr_diff_view: false)
end end
def create_merge_request(source_branch) def create_merge_request(source_branch)
...@@ -18,8 +17,6 @@ describe 'Merge request > User resolves conflicts', :js do ...@@ -18,8 +17,6 @@ describe 'Merge request > User resolves conflicts', :js do
end end
end end
it_behaves_like 'rendering a single diff version'
shared_examples 'conflicts are resolved in Interactive mode' do shared_examples 'conflicts are resolved in Interactive mode' do
it 'conflicts are resolved in Interactive mode' do it 'conflicts are resolved in Interactive mode' do
within find('.files-wrapper .diff-file', text: 'files/ruby/popen.rb') do within find('.files-wrapper .diff-file', text: 'files/ruby/popen.rb') do
......
...@@ -20,12 +20,9 @@ describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -20,12 +20,9 @@ describe 'Merge request > User resolves diff notes and threads', :js do
end end
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
end end
it_behaves_like 'rendering a single diff version'
context 'no threads' do context 'no threads' do
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -21,7 +21,6 @@ describe 'Merge request > User sees avatars on diff notes', :js do ...@@ -21,7 +21,6 @@ describe 'Merge request > User sees avatars on diff notes', :js do
let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) } let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in user sign_in user
...@@ -29,8 +28,6 @@ describe 'Merge request > User sees avatars on diff notes', :js do ...@@ -29,8 +28,6 @@ describe 'Merge request > User sees avatars on diff notes', :js do
set_cookie('sidebar_collapsed', 'true') set_cookie('sidebar_collapsed', 'true')
end end
it_behaves_like 'rendering a single diff version'
context 'discussion tab' do context 'discussion tab' do
before do before do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
......
...@@ -10,12 +10,9 @@ describe 'Merge request > User sees diff', :js do ...@@ -10,12 +10,9 @@ describe 'Merge request > User sees diff', :js do
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
end end
it_behaves_like 'rendering a single diff version'
context 'when linking to note' do context 'when linking to note' do
describe 'with unresolved note' do describe 'with unresolved note' do
let(:note) { create :diff_note_on_merge_request, project: project, noteable: merge_request } let(:note) { create :diff_note_on_merge_request, project: project, noteable: merge_request }
......
...@@ -11,14 +11,11 @@ describe 'Merge request > User sees MR with deleted source branch', :js do ...@@ -11,14 +11,11 @@ describe 'Merge request > User sees MR with deleted source branch', :js do
let(:user) { project.creator } let(:user) { project.creator }
before do before do
stub_feature_flags(single_mr_diff_view: false)
merge_request.update!(source_branch: 'this-branch-does-not-exist') merge_request.update!(source_branch: 'this-branch-does-not-exist')
sign_in(user) sign_in(user)
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
it_behaves_like 'rendering a single diff version'
it 'shows a message about missing source branch' do it 'shows a message about missing source branch' do
expect(page).to have_content('Source branch does not exist.') expect(page).to have_content('Source branch does not exist.')
end end
......
...@@ -16,7 +16,6 @@ describe 'Merge request > User sees versions', :js do ...@@ -16,7 +16,6 @@ describe 'Merge request > User sees versions', :js do
let!(:params) { {} } let!(:params) { {} }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
project.add_maintainer(user) project.add_maintainer(user)
...@@ -24,8 +23,6 @@ describe 'Merge request > User sees versions', :js do ...@@ -24,8 +23,6 @@ describe 'Merge request > User sees versions', :js do
visit diffs_project_merge_request_path(project, merge_request, params) visit diffs_project_merge_request_path(project, merge_request, params)
end end
it_behaves_like 'rendering a single diff version'
shared_examples 'allows commenting' do |file_id:, line_code:, comment:| shared_examples 'allows commenting' do |file_id:, line_code:, comment:|
it do it do
diff_file_selector = ".diff-file[id='#{file_id}']" diff_file_selector = ".diff-file[id='#{file_id}']"
......
...@@ -25,15 +25,12 @@ describe 'User comments on a diff', :js do ...@@ -25,15 +25,12 @@ describe 'User comments on a diff', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
visit(diffs_project_merge_request_path(project, merge_request)) visit(diffs_project_merge_request_path(project, merge_request))
end end
it_behaves_like 'rendering a single diff version'
context 'single suggestion note' do context 'single suggestion note' do
it 'hides suggestion popover' do it 'hides suggestion popover' do
click_diff_line(find("[id='#{sample_compare.changes[1][:line_code]}']")) click_diff_line(find("[id='#{sample_compare.changes[1][:line_code]}']"))
......
...@@ -8,7 +8,6 @@ describe 'Merge request > User toggles whitespace changes', :js do ...@@ -8,7 +8,6 @@ describe 'Merge request > User toggles whitespace changes', :js do
let(:user) { project.creator } let(:user) { project.creator }
before do before do
stub_feature_flags(single_mr_diff_view: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
visit diffs_project_merge_request_path(project, merge_request) visit diffs_project_merge_request_path(project, merge_request)
...@@ -16,8 +15,6 @@ describe 'Merge request > User toggles whitespace changes', :js do ...@@ -16,8 +15,6 @@ describe 'Merge request > User toggles whitespace changes', :js do
find('.js-show-diff-settings').click find('.js-show-diff-settings').click
end end
it_behaves_like 'rendering a single diff version'
it 'has a button to toggle whitespace changes' do it 'has a button to toggle whitespace changes' do
expect(page).to have_content 'Show whitespace changes' expect(page).to have_content 'Show whitespace changes'
end end
......
...@@ -9,7 +9,6 @@ describe 'User views diffs', :js do ...@@ -9,7 +9,6 @@ describe 'User views diffs', :js do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
visit(diffs_project_merge_request_path(project, merge_request)) visit(diffs_project_merge_request_path(project, merge_request))
...@@ -18,8 +17,6 @@ describe 'User views diffs', :js do ...@@ -18,8 +17,6 @@ describe 'User views diffs', :js do
find('.js-toggle-tree-list').click find('.js-toggle-tree-list').click
end end
it_behaves_like 'rendering a single diff version'
shared_examples 'unfold diffs' do shared_examples 'unfold diffs' do
it 'unfolds diffs upwards' do it 'unfolds diffs upwards' do
first('.js-unfold').click first('.js-unfold').click
......
...@@ -12,11 +12,9 @@ describe 'Editing file blob', :js do ...@@ -12,11 +12,9 @@ describe 'Editing file blob', :js do
let(:readme_file_path) { 'README.md' } let(:readme_file_path) { 'README.md' }
before do before do
stub_feature_flags(web_ide_default: false, single_mr_diff_view: false) stub_feature_flags(web_ide_default: false)
end end
it_behaves_like 'rendering a single diff version'
context 'as a developer' do context 'as a developer' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:role) { :developer } let(:role) { :developer }
......
...@@ -9,14 +9,11 @@ describe 'View on environment', :js do ...@@ -9,14 +9,11 @@ describe 'View on environment', :js do
let(:user) { project.creator } let(:user) { project.creator }
before do before do
stub_feature_flags(single_mr_diff_view: false)
stub_feature_flags(diffs_batch_load: false) stub_feature_flags(diffs_batch_load: false)
project.add_maintainer(user) project.add_maintainer(user)
end end
it_behaves_like 'rendering a single diff version'
context 'when the branch has a route map' do context 'when the branch has a route map' do
let(:route_map) do let(:route_map) do
<<-MAP.strip_heredoc <<-MAP.strip_heredoc
......
# frozen_string_literal: true
# This pending test can be removed when `single_mr_diff_view` is enabled by default
# disabling the feature flag above is then not needed anymore.
RSpec.shared_examples 'rendering a single diff version' do |attribute|
before do
stub_feature_flags(diffs_batch_load: false)
end
pending 'allows editing diff settings single_mr_diff_view is enabled' do
project = create(:project, :repository)
user = project.creator
merge_request = create(:merge_request, source_project: project)
stub_feature_flags(single_mr_diff_view: true)
sign_in(user)
visit(diffs_project_merge_request_path(project, merge_request))
expect(page).to have_selector('.js-show-diff-settings')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment