summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-24 08:57:04 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-24 08:57:04 +0000
commit85b872f340507d40c5f75e948b621952c7946cb3 (patch)
treed54cca3d6330ec6e20ff4f76a12f4473910b9712 /test
parent3269fab34e86fb413d8d63c19c57a2234144c973 (diff)
downloadredmine-85b872f340507d40c5f75e948b621952c7946cb3.tar.gz
redmine-85b872f340507d40c5f75e948b621952c7946cb3.zip
Makes project custom fields available on spent time report (#1766).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11459 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/time_entry_reports_controller_test.rb34
1 files changed, 24 insertions, 10 deletions
diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb
index 0e1fe7c84..759d5d19b 100644
--- a/test/functional/time_entry_reports_controller_test.rb
+++ b/test/functional/time_entry_reports_controller_test.rb
@@ -125,22 +125,36 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
:attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'}
end
- def test_report_custom_field_criteria
- get :report, :project_id => 1, :criteria => ['project', 'cf_1', 'cf_7']
+ def test_report_should_propose_association_custom_fields
+ get :report
+ assert_response :success
+ assert_template 'report'
+
+ assert_select 'select[name=?]', 'criteria[]' do
+ assert_select 'option[value=cf_1]', {:text => 'Database'}, 'Issue custom field not found'
+ assert_select 'option[value=cf_3]', {:text => 'Development status'}, 'Project custom field not found'
+ assert_select 'option[value=cf_7]', {:text => 'Billable'}, 'TimeEntryActivity custom field not found'
+ end
+ end
+
+ def test_report_with_association_custom_fields
+ get :report, :criteria => ['cf_1', 'cf_3', 'cf_7']
assert_response :success
assert_template 'report'
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 fields columns
+ assert_select 'th', :text => 'Database'
+ assert_select 'th', :text => 'Development status'
+ assert_select 'th', :text => 'Billable'
+
# Custom field row
- assert_tag :tag => 'td', :content => 'MySQL',
- :sibling => { :tag => 'td', :attributes => { :class => 'hours' },
- :child => { :tag => 'span', :attributes => { :class => 'hours hours-int' },
- :content => '1' }}
- # Second custom field column
- assert_tag :tag => 'th', :content => 'Billable'
+ assert_select 'tr' do
+ assert_select 'td', :text => 'MySQL'
+ assert_select 'td.hours', :text => '1.00'
+ end
end
def test_report_one_criteria_no_result