fix_csv_export_when_issues_filter_is_blank_v2.diff

patch v2 - Go MAEDA, 2016-06-30 16:37

Download (1.5 KB)

View differences:

app/helpers/queries_helper.rb (working copy)
257 257
          tags << hidden_field_tag("v[#{field}][]", value, :id => nil)
258 258
        end
259 259
      end
260
    else
261
      tags << hidden_field_tag("f[]", "", :id => nil)
260 262
    end
261 263
    if query.column_names.present?
262 264
      query.column_names.each do |name|
test/functional/issues_controller_test.rb (working copy)
488 488

  
489 489
      assert_select 'input[name=?][value=?]', 'sort', 'status'
490 490
    end
491

  
492
    get :index, :project_id => 1, :set_filter => "1", :f => []
493
    assert_select '#csv-export-form input[name=?][value=?]', 'f[]', ''
491 494
  end
492 495

  
493 496
  def test_index_csv
......
507 510
    assert_equal 'text/csv; header=present', @response.content_type
508 511
  end
509 512

  
513
  def test_index_csv_without_any_filters
514
    @request.session[:user_id] = 1
515
    Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :author_id => 1)
516
    get :index, :set_filter => 1, :f => [], :format => 'csv'
517
    assert_response :success
518
    assert_equal Issue.count, assigns(:issues).count
519
  end
520

  
510 521
  def test_index_csv_with_description
511 522
    Issue.generate!(:description => 'test_index_csv_with_description')
512 523