mirror of
https://github.com/redmine/redmine.git
synced 2026-03-03 11:01:24 +01:00
Adds a dialog box for CSV export options (#4742).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7874 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -281,21 +281,43 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
get :index, :sort => 'tracker'
|
||||
end
|
||||
|
||||
def test_index_csv_with_project
|
||||
Setting.default_language = 'en'
|
||||
|
||||
def test_index_csv
|
||||
get :index, :format => 'csv'
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:issues)
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_with_project
|
||||
get :index, :project_id => 1, :format => 'csv'
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:issues)
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
end
|
||||
|
||||
def test_index_csv_with_description
|
||||
get :index, :format => 'csv', :description => '1'
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:issues)
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_with_all_columns
|
||||
get :index, :format => 'csv', :columns => 'all'
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:issues)
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_big_5
|
||||
with_settings :default_language => "zh-TW" do
|
||||
str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88"
|
||||
@@ -314,7 +336,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
:op => '=', :values => [str_utf8],
|
||||
:format => 'csv'
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
lines = @response.body.chomp.split("\n")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
s1 = "\xaa\xac\xbaA"
|
||||
if str_utf8.respond_to?(:force_encoding)
|
||||
s1.force_encoding('Big5')
|
||||
@@ -338,17 +360,19 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
get :index, :project_id => 1,
|
||||
:f => ['subject'],
|
||||
:op => '=', :values => [str_utf8],
|
||||
:format => 'csv'
|
||||
:c => ['status', 'subject'],
|
||||
:format => 'csv',
|
||||
:set_filter => 1
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
lines = @response.body.chomp.split("\n")
|
||||
s1 = "\xaa\xac\xbaA"
|
||||
lines = @response.body.chomp.split("\n")
|
||||
s1 = "\xaa\xac\xbaA" # status
|
||||
if str_utf8.respond_to?(:force_encoding)
|
||||
s1.force_encoding('Big5')
|
||||
end
|
||||
assert lines[0].include?(s1)
|
||||
s2 = lines[1].split(",")[5]
|
||||
s2 = lines[1].split(",")[2]
|
||||
if s1.respond_to?(:force_encoding)
|
||||
s3 = "\xa5H?"
|
||||
s3 = "\xa5H?" # subject
|
||||
s3.force_encoding('Big5')
|
||||
assert_equal s3, s2
|
||||
elsif RUBY_PLATFORM == 'java'
|
||||
|
||||
Reference in New Issue
Block a user