summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-20 13:23:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-20 13:23:20 +0000
commitca300ccdeaf3cae3015a548ba3fffa9c6f112c55 (patch)
tree9b7d5d049a044c2cc39d44ca9a3e7d8af7edb614 /test/functional/issues_controller_test.rb
parent617cb8d270acdf78f2c0c144d89668cd28750691 (diff)
downloadredmine-ca300ccdeaf3cae3015a548ba3fffa9c6f112c55.tar.gz
redmine-ca300ccdeaf3cae3015a548ba3fffa9c6f112c55.zip
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
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r--test/functional/issues_controller_test.rb42
1 files changed, 33 insertions, 9 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index b350512af..017f47451 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -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'