Commit 91296aff authored by James Edwards-Jones's avatar James Edwards-Jones

Issue CSV ignores pagination

parent 1a56196b
......@@ -25,11 +25,14 @@ class Projects::IssuesController < Projects::ApplicationController
def index
@collection_type = "Issue"
@issues = issues_collection
@issues = @issues.page(params[:page])
@issuable_meta_data = issuable_meta_data(@issues)
if @issues.out_of_range? && @issues.total_pages != 0
return redirect_to url_for(params.merge(page: @issues.total_pages))
if !request.format.csv?
@issues = @issues.page(params[:page])
@issuable_meta_data = issuable_meta_data(@issues)
if @issues.out_of_range? && @issues.total_pages != 0
return redirect_to url_for(params.merge(page: @issues.total_pages))
end
end
if params[:label_name].present?
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Issues csv', feature: true do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:project) { create(:empty_project, :public) }
let!(:issue) { create(:issue, project: project) }
before { login_as(user) }
......@@ -10,9 +10,19 @@ describe 'Issues csv', feature: true do
it "downloads from a project's issue index" do
visit namespace_project_issues_path(project.namespace, project)
click_on 'Download CSV'
expect(page.response_headers['Content-Type']).to include('csv')
end
it 'ignores pagination' do
create_list(:issue, 30, project: project)
visit namespace_project_issues_path(project.namespace, project)
click_on 'Download CSV'
expect(csv.count).to eq 31
end
context 'includes' do
let(:label1) { create(:label, project: project, title: 'Feature') }
let(:label2) { create(:label, project: project, title: 'labels') }
......@@ -55,6 +65,7 @@ describe 'Issues csv', feature: true do
context 'with minimal details' do
it 'renders labels as nil' do
visit namespace_project_issues_path(project.namespace, project, format: :csv)
expect(csv[0]['Labels']).to eq nil
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