summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-02 18:46:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-02 18:46:43 +0000
commitcaf898d7d13fa9df8acfaab4a7163f123cb59bf9 (patch)
tree49ab4b81753eb80bcc687ef48403d77c063a2615 /test
parentda140238e778abb2b4dabe8c3b1d8167ffca3cad (diff)
downloadredmine-caf898d7d13fa9df8acfaab4a7163f123cb59bf9.tar.gz
redmine-caf898d7d13fa9df8acfaab4a7163f123cb59bf9.zip
Extracted time report logic from the controller.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8026 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/time_entry_reports_controller_test.rb69
1 files changed, 34 insertions, 35 deletions
diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb
index 30ebe89d0..1c5c5801e 100644
--- a/test/functional/time_entry_reports_controller_test.rb
+++ b/test/functional/time_entry_reports_controller_test.rb
@@ -38,72 +38,71 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
end
def test_report_all_projects_one_criteria
- get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project']
+ get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "8.65", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "8.65", "%.2f" % assigns(:report).total_hours
end
def test_report_all_time
- get :report, :project_id => 1, :criterias => ['project', 'issue']
+ get :report, :project_id => 1, :criteria => ['project', 'issue']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "162.90", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "162.90", "%.2f" % assigns(:report).total_hours
end
def test_report_all_time_by_day
- get :report, :project_id => 1, :criterias => ['project', 'issue'], :columns => 'day'
+ get :report, :project_id => 1, :criteria => ['project', 'issue'], :columns => 'day'
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "162.90", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "162.90", "%.2f" % assigns(:report).total_hours
assert_tag :tag => 'th', :content => '2007-03-12'
end
def test_report_one_criteria
- get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project']
+ get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "8.65", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "8.65", "%.2f" % assigns(:report).total_hours
end
- def test_report_two_criterias
- get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
+ def test_report_two_criteria
+ get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"]
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "162.90", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "162.90", "%.2f" % assigns(:report).total_hours
end
def test_report_one_day
- get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"]
+ get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["member", "activity"]
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "4.25", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "4.25", "%.2f" % assigns(:report).total_hours
end
def test_report_at_issue_level
- get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
+ get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["member", "activity"]
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "154.25", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "154.25", "%.2f" % assigns(:report).total_hours
assert_tag :form,
:attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'}
end
def test_report_custom_field_criteria
- get :report, :project_id => 1, :criterias => ['project', 'cf_1', 'cf_7']
+ get :report, :project_id => 1, :criteria => ['project', 'cf_1', 'cf_7']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_not_nil assigns(:criterias)
- assert_equal 3, assigns(:criterias).size
- assert_equal "162.90", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal 3, assigns(:report).criteria.size
+ assert_equal "162.90", "%.2f" % assigns(:report).total_hours
# Custom field column
assert_tag :tag => 'th', :content => 'Database'
# Custom field row
@@ -116,16 +115,16 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
end
def test_report_one_criteria_no_result
- get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criterias => ['project']
+ get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criteria => ['project']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:total_hours)
- assert_equal "0.00", "%.2f" % assigns(:total_hours)
+ assert_not_nil assigns(:report)
+ assert_equal "0.00", "%.2f" % assigns(:report).total_hours
end
def test_report_all_projects_csv_export
get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30",
- :criterias => ["project", "member", "activity"], :format => "csv"
+ :criteria => ["project", "member", "activity"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")
@@ -139,7 +138,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
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"
+ :criteria => ["project", "member", "activity"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")
@@ -177,7 +176,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
get :report, :project_id => 1, :columns => 'day',
:from => "2011-11-11", :to => "2011-11-11",
- :criterias => ["member"], :format => "csv"
+ :criteria => ["member"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")
@@ -228,7 +227,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
get :report, :project_id => 1, :columns => 'day',
:from => "2011-11-11", :to => "2011-11-11",
- :criterias => ["member"], :format => "csv"
+ :criteria => ["member"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")
@@ -269,7 +268,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
get :report, :project_id => 1, :columns => 'day',
:from => "2011-11-11", :to => "2011-11-11",
- :criterias => ["member"], :format => "csv"
+ :criteria => ["member"], :format => "csv"
assert_response :success
assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n")