mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-07 17:53:05 +00:00
Patch by Takenori TAKAKI. git-svn-id: https://svn.redmine.org/redmine/trunk@22121 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
a499d68802
commit
4dc56cd943
@ -61,7 +61,7 @@ class UsersController < ApplicationController
|
|||||||
format.csv do
|
format.csv do
|
||||||
# Export all entries
|
# Export all entries
|
||||||
@entries = scope.to_a
|
@entries = scope.to_a
|
||||||
send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'users.csv')
|
send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => "#{filename_for_export(@query, 'users')}.csv")
|
||||||
end
|
end
|
||||||
format.api do
|
format.api do
|
||||||
@offset, @limit = api_offset_and_limit
|
@offset, @limit = api_offset_and_limit
|
||||||
|
|||||||
@ -280,6 +280,19 @@ class UsersControllerTest < Redmine::ControllerTest
|
|||||||
assert_equal 'text/csv; header=present', @response.media_type
|
assert_equal 'text/csv; header=present', @response.media_type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_index_csv_filename_without_query_id_param
|
||||||
|
get :index, :params => {:format => 'csv'}
|
||||||
|
assert_response :success
|
||||||
|
assert_match /users.csv/, @response.headers['Content-Disposition']
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_index_csv_filename_with_query_id_param
|
||||||
|
query = UserQuery.create!(:name => 'My Query Name', :visibility => UserQuery::VISIBILITY_PUBLIC)
|
||||||
|
get :index, :params => {:query_id => query.id, :format => 'csv'}
|
||||||
|
assert_response :success
|
||||||
|
assert_match /my_query_name\.csv/, @response.headers['Content-Disposition']
|
||||||
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
@request.session[:user_id] = nil
|
@request.session[:user_id] = nil
|
||||||
get :show, :params => {:id => 2}
|
get :show, :params => {:id => 2}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user