Issue index CSV uses currently applied filters

This commit is contained in:
James Edwards-Jones 2016-10-07 19:22:43 +01:00
parent 17600f5f6a
commit c777bb91fd
3 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#
class IssuableFinder
NONE = '0'
VALID_PARAMS = %i(scope state group_id project_id milestone_title assignee_id search label_name sort)
attr_accessor :current_user, :params

View File

@ -21,7 +21,7 @@
- if current_user
= link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn append-right-10 has-tooltip', title: 'Subscribe' do
= icon('rss')
= link_to namespace_project_issues_path(@project.namespace, @project, :csv), class: 'btn append-right-10 has-tooltip', title: 'Download CSV' do
= link_to namespace_project_issues_path(@project.namespace, @project, params.permit(IssuableFinder::VALID_PARAMS).merge(format: :csv)), class: 'btn append-right-10 has-tooltip', title: 'Download CSV' do
= icon('download')
- if can? current_user, :create_issue, @project
= link_to new_namespace_project_issue_path(@project.namespace,

View File

@ -23,6 +23,13 @@ describe 'Issues csv', feature: true do
expect(csv.count).to eq 31
end
it 'uses filters from issue index' do
visit namespace_project_issues_path(project.namespace, project, state: :closed)
click_on 'Download CSV'
expect(csv.count).to eq 0
end
context 'includes' do
let(:label1) { create(:label, project: project, title: 'Feature') }
let(:label2) { create(:label, project: project, title: 'labels') }