CSV export added to timelog report (#1009).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1338 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-04-07 17:18:09 +00:00
parent fc1a295d8a
commit 5d34548539
4 changed files with 73 additions and 2 deletions

View File

@@ -118,7 +118,18 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_template 'report'
assert_not_nil assigns(:total_hours)
assert_equal "0.00", "%.2f" % assigns(:total_hours)
end
end
def test_report_csv_export
get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")
# Headers
assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', lines.first
# Total row
assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last
end
def test_details_at_project_level
get :details, :project_id => 1