Commit 3996bd75 authored by Phil Hughes's avatar Phil Hughes

Fixed failing diffs action specs

Stubbed feature flag in the ruby specs
parent cca0b3be
......@@ -62,6 +62,7 @@ module Gitlab
@merge_request_diff.merge_request_diff_files
end
# rubocop: disable CodeReuse/ActiveRecord
def load_paginated_collection(batch_page, batch_size, diff_options)
batch_page ||= DEFAULT_BATCH_PAGE
batch_size = [batch_size.to_i, DEFAULT_BATCH_SIZE].min
......@@ -69,14 +70,16 @@ module Gitlab
paths = diff_options&.fetch(:paths, nil)
paginated_collection = if batch_gradual_load?
relation.offset(batch_page).limit(batch_size)
else
relation.page(batch_page).per(batch_size)
end
relation.offset(batch_page).limit(batch_size)
else
relation.page(batch_page).per(batch_size)
end
paginated_collection = paginated_collection.by_paths(paths) if paths
paginated_collection
end
# rubocop: enable CodeReuse/ActiveRecord
def batch_gradual_load?
Feature.enabled?(:diffs_gradual_load, @merge_request_diff.project)
......
......@@ -5,6 +5,10 @@ require 'spec_helper'
RSpec.describe Projects::MergeRequests::DiffsController do
include ProjectForksHelper
before do
stub_feature_flags(diffs_gradual_load: false)
end
shared_examples '404 for unexistent diffable' do
context 'when diffable does not exists' do
it 'returns 404' do
......
......@@ -17,6 +17,8 @@ RSpec.describe 'Merge request > User sees versions', :js do
let!(:params) { {} }
before do
stub_feature_flags(diffs_gradual_load: false)
project.add_maintainer(user)
sign_in(user)
visit diffs_project_merge_request_path(project, merge_request, params)
......
......@@ -159,10 +159,10 @@ describe('DiffsStoreActions', () => {
.onGet(
mergeUrlParams(
{
per_page: DIFFS_PER_PAGE,
w: '1',
view: 'inline',
page: 1,
per_page: DIFFS_PER_PAGE,
},
endpointBatch,
),
......@@ -171,10 +171,10 @@ describe('DiffsStoreActions', () => {
.onGet(
mergeUrlParams(
{
per_page: DIFFS_PER_PAGE,
w: '1',
view: 'inline',
page: 2,
per_page: DIFFS_PER_PAGE,
},
endpointBatch,
),
......
......@@ -9,6 +9,10 @@ RSpec.describe MergeRequestDiff do
let(:diff_with_commits) { create(:merge_request).merge_request_diff }
before do
stub_feature_flags(diffs_gradual_load: false)
end
describe 'validations' do
subject { diff_with_commits }
......
......@@ -19,6 +19,10 @@ RSpec.describe PaginatedDiffEntity do
subject { entity.as_json }
before do
stub_feature_flags(diffs_gradual_load: false)
end
it 'exposes diff_files' do
expect(subject[:diff_files]).to be_present
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