Feature #36391 ยป 36391.patch
config/settings.yml | ||
---|---|---|
170 | 170 |
time_format: |
171 | 171 |
default: '' |
172 | 172 |
timespan_format: |
173 |
default: 'decimal'
|
|
173 |
default: 'minutes'
|
|
174 | 174 |
user_format: |
175 | 175 |
default: :firstname_lastname |
176 | 176 |
format: symbol |
test/functional/issues_controller_test.rb | ||
---|---|---|
1322 | 1322 |
} |
1323 | 1323 |
) |
1324 | 1324 |
assert_response :success |
1325 |
assert_equal ['4.00', '3.00', '0.00'], columns_values_in_list('spent_hours')[0..2]
|
|
1325 |
assert_equal ['4:00', '3:00', '0:00'], columns_values_in_list('spent_hours').first(3)
|
|
1326 | 1326 |
Project.find(3).disable_module!(:time_tracking) |
1327 | 1327 |
get( |
1328 | 1328 |
:index, |
... | ... | |
1332 | 1332 |
} |
1333 | 1333 |
) |
1334 | 1334 |
assert_response :success |
1335 |
assert_equal ['3.00', '0.00', '0.00'], columns_values_in_list('spent_hours')[0..2]
|
|
1335 |
assert_equal ['3:00', '0:00', '0:00'], columns_values_in_list('spent_hours').first(3)
|
|
1336 | 1336 |
end |
1337 | 1337 | |
1338 | 1338 |
def test_index_sort_by_total_spent_hours |
... | ... | |
1555 | 1555 |
:c => %w(subject spent_hours) |
1556 | 1556 |
} |
1557 | 1557 |
) |
1558 |
assert_select 'table.issues tr#issue-3 td.spent_hours', :text => '1.00'
|
|
1558 |
assert_select 'table.issues tr#issue-3 td.spent_hours', :text => '1:00'
|
|
1559 | 1559 |
end |
1560 | 1560 | |
1561 | 1561 |
def test_index_with_total_spent_hours_column |
... | ... | |
1567 | 1567 |
:c => %w(subject total_spent_hours) |
1568 | 1568 |
} |
1569 | 1569 |
) |
1570 |
assert_select 'table.issues tr#issue-3 td.total_spent_hours', :text => '1.00'
|
|
1570 |
assert_select 'table.issues tr#issue-3 td.total_spent_hours', :text => '1:00'
|
|
1571 | 1571 |
end |
1572 | 1572 | |
1573 | 1573 |
def test_index_with_total_estimated_hours_column |
... | ... | |
1874 | 1874 | |
1875 | 1875 |
def test_index_with_estimated_hours_total |
1876 | 1876 |
Issue.delete_all |
1877 |
Issue.generate!(:estimated_hours => 5.5)
|
|
1878 |
Issue.generate!(:estimated_hours => 1.1)
|
|
1877 |
Issue.generate!(:estimated_hours => '5:30')
|
|
1878 |
Issue.generate!(:estimated_hours => '1:06')
|
|
1879 | 1879 |
get(:index, :params => {:t => %w(estimated_hours)}) |
1880 | 1880 |
assert_response :success |
1881 | 1881 |
assert_select '.query-totals' |
1882 |
assert_select '.total-for-estimated-hours span.value', :text => '6.60'
|
|
1882 |
assert_select '.total-for-estimated-hours span.value', :text => '6:36'
|
|
1883 | 1883 |
assert_select 'input[type=checkbox][name=?][value=estimated_hours][checked=checked]', 't[]' |
1884 | 1884 |
end |
1885 | 1885 | |
1886 | 1886 |
def test_index_with_grouped_query_and_estimated_hours_total |
1887 | 1887 |
Issue.delete_all |
1888 |
Issue.generate!(:estimated_hours => 5.5, :category_id => 1)
|
|
1889 |
Issue.generate!(:estimated_hours => 2.3, :category_id => 1)
|
|
1890 |
Issue.generate!(:estimated_hours => 1.1, :category_id => 2)
|
|
1891 |
Issue.generate!(:estimated_hours => 4.6)
|
|
1888 |
Issue.generate!(:estimated_hours => '5:30', :category_id => 1)
|
|
1889 |
Issue.generate!(:estimated_hours => '2:18', :category_id => 1)
|
|
1890 |
Issue.generate!(:estimated_hours => '1:06', :category_id => 2)
|
|
1891 |
Issue.generate!(:estimated_hours => '4:36')
|
|
1892 | 1892 |
get( |
1893 | 1893 |
:index, |
1894 | 1894 |
:params => { |
... | ... | |
1898 | 1898 |
) |
1899 | 1899 |
assert_response :success |
1900 | 1900 |
assert_select '.query-totals' |
1901 |
assert_select '.query-totals .total-for-estimated-hours span.value', :text => '13.50'
|
|
1901 |
assert_select '.query-totals .total-for-estimated-hours span.value', :text => '13:30'
|
|
1902 | 1902 |
assert_select 'tr.group', :text => /Printing/ do |
1903 |
assert_select '.total-for-estimated-hours span.value', :text => '7.80'
|
|
1903 |
assert_select '.total-for-estimated-hours span.value', :text => '7:48'
|
|
1904 | 1904 |
end |
1905 | 1905 |
assert_select 'tr.group', :text => /Recipes/ do |
1906 |
assert_select '.total-for-estimated-hours span.value', :text => '1.10'
|
|
1906 |
assert_select '.total-for-estimated-hours span.value', :text => '1:06'
|
|
1907 | 1907 |
end |
1908 | 1908 |
assert_select 'tr.group', :text => /blank/ do |
1909 |
assert_select '.total-for-estimated-hours span.value', :text => '4.60'
|
|
1909 |
assert_select '.total-for-estimated-hours span.value', :text => '4:36'
|
|
1910 | 1910 |
end |
1911 | 1911 |
end |
1912 | 1912 | |
... | ... | |
1927 | 1927 | |
1928 | 1928 |
get :index, :params => {:t => ["spent_hours"]} |
1929 | 1929 |
assert_response :success |
1930 |
assert_select ".total-for-spent-hours span.value", :text => '7.00'
|
|
1930 |
assert_select ".total-for-spent-hours span.value", :text => '7:00'
|
|
1931 | 1931 | |
1932 | 1932 |
Project.find(3).disable_module!(:time_tracking) |
1933 | 1933 | |
1934 | 1934 |
get :index, :params => {:t => ["spent_hours"]} |
1935 | 1935 |
assert_response :success |
1936 |
assert_select ".total-for-spent-hours span.value", :text => '3.00'
|
|
1936 |
assert_select ".total-for-spent-hours span.value", :text => '3:00'
|
|
1937 | 1937 |
end |
1938 | 1938 | |
1939 | 1939 |
def test_index_totals_should_default_to_settings |
... | ... | |
5652 | 5652 |
:priority_id => 7 |
5653 | 5653 |
}, |
5654 | 5654 |
:time_entry => { |
5655 |
:hours => '2.5',
|
|
5655 |
:hours => '2:30',
|
|
5656 | 5656 |
:comments => 'test_get_edit_with_params', |
5657 | 5657 |
:activity_id => 10 |
5658 | 5658 |
} |
... | ... | |
5668 | 5668 |
assert_select 'option[value="7"][selected=selected]', :text => 'Urgent' |
5669 | 5669 |
end |
5670 | 5670 | |
5671 |
assert_select 'input[name=?][value="2.50"]', 'time_entry[hours]'
|
|
5671 |
assert_select 'input[name=?][value="2:30"]', 'time_entry[hours]'
|
|
5672 | 5672 |
assert_select 'select[name=?]', 'time_entry[activity_id]' do |
5673 | 5673 |
assert_select 'option[value="10"][selected=selected]', :text => 'Development' |
5674 | 5674 |
end |
test/functional/issues_controller_transaction_test.rb | ||
---|---|---|
341 | 341 |
:subject => '' |
342 | 342 |
}, |
343 | 343 |
:time_entry => { |
344 |
:hours => '2.5',
|
|
344 |
:hours => '2:30',
|
|
345 | 345 |
:comments => 'should not be added', |
346 | 346 |
:activity_id => TimeEntryActivity.first.id |
347 | 347 |
} |
... | ... | |
350 | 350 |
assert_response :success |
351 | 351 |
end |
352 | 352 | |
353 |
assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2.50'
|
|
353 |
assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2:30'
|
|
354 | 354 |
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added' |
355 | 355 |
assert_select 'select[name=?]', 'time_entry[activity_id]' do |
356 | 356 |
assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id.to_s |
test/functional/my_controller_test.rb | ||
---|---|---|
60 | 60 |
assert_response :success |
61 | 61 |
assert_select "tr#time-entry-#{with_issue.id}" do |
62 | 62 |
assert_select 'td.subject a[href="/issues/1"]' |
63 |
assert_select 'td.hours', :text => '2.50'
|
|
63 |
assert_select 'td.hours', :text => '2:30'
|
|
64 | 64 |
end |
65 | 65 |
assert_select "tr#time-entry-#{without_issue.id}" do |
66 |
assert_select 'td.hours', :text => '3.50'
|
|
66 |
assert_select 'td.hours', :text => '3:30'
|
|
67 | 67 |
end |
68 | 68 |
end |
69 | 69 |
test/functional/projects_controller_test.rb | ||
---|---|---|
796 | 796 |
@request.session[:user_id] = 1 |
797 | 797 |
get(:show, :params => {:id => 'ecookbook'}) |
798 | 798 |
assert_select 'div.spent_time.box>ul' do |
799 |
assert_select '>li:nth-child(1)', :text => 'Estimated time: 203.50 hours'
|
|
800 |
assert_select '>li:nth-child(2)', :text => 'Spent time: 162.90 hours'
|
|
799 |
assert_select '>li:nth-child(1)', :text => 'Estimated time: 203:30 hours'
|
|
800 |
assert_select '>li:nth-child(2)', :text => 'Spent time: 162:54 hours'
|
|
801 | 801 |
end |
802 | 802 |
end |
803 | 803 |
test/functional/timelog_controller_test.rb | ||
---|---|---|
929 | 929 |
get :index |
930 | 930 |
assert_response :success |
931 | 931 | |
932 |
assert_select '.total-for-hours', :text => 'Hours: 162.90'
|
|
932 |
assert_select '.total-for-hours', :text => 'Hours: 162:54'
|
|
933 | 933 |
assert_select 'form#query_form[action=?]', '/time_entries' |
934 | 934 | |
935 | 935 |
assert_equal ['Project', 'Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list |
... | ... | |
1008 | 1008 |
projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort |
1009 | 1009 |
assert_equal ["eCookbook", "eCookbook Subproject 1"], projects |
1010 | 1010 | |
1011 |
assert_select '.total-for-hours', :text => 'Hours: 162.90'
|
|
1011 |
assert_select '.total-for-hours', :text => 'Hours: 162:54'
|
|
1012 | 1012 |
assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries' |
1013 | 1013 | |
1014 | 1014 |
# 'Log time' shoudl link to log time on the filtered issue |
... | ... | |
1046 | 1046 |
@request.session[:user_id] = 2 |
1047 | 1047 | |
1048 | 1048 |
get :index, :params => {:project_id => 'ecookbook', :issue_id => issue.id.to_s, :set_filter => 1} |
1049 |
assert_select '.total-for-hours', :text => 'Hours: 7.00'
|
|
1049 |
assert_select '.total-for-hours', :text => 'Hours: 7:00'
|
|
1050 | 1050 | |
1051 | 1051 |
# 'Log time' shoudl link to log time on the filtered issue |
1052 | 1052 |
assert_select 'a[href=?]', "/issues/#{issue.id}/time_entries/new" |
... | ... | |
1060 | 1060 |
@request.session[:user_id] = 2 |
1061 | 1061 | |
1062 | 1062 |
get :index, :params => {:project_id => 'ecookbook', :"issue.fixed_version_id" => version.id.to_s, :set_filter => 1} |
1063 |
assert_select '.total-for-hours', :text => 'Hours: 5.00'
|
|
1063 |
assert_select '.total-for-hours', :text => 'Hours: 5:00'
|
|
1064 | 1064 |
end |
1065 | 1065 | |
1066 | 1066 |
def test_index_at_project_level_with_multiple_issue_fixed_version_ids |
... | ... | |
1084 | 1084 |
assert_response :success |
1085 | 1085 | |
1086 | 1086 |
assert_select 'tr.time-entry', 2 |
1087 |
assert_select '.total-for-hours', :text => 'Hours: 5.00'
|
|
1087 |
assert_select '.total-for-hours', :text => 'Hours: 5:00'
|
|
1088 | 1088 |
end |
1089 | 1089 | |
1090 | 1090 |
def test_index_at_project_level_with_date_range |
... | ... | |
1100 | 1100 |
assert_response :success |
1101 | 1101 | |
1102 | 1102 |
assert_select 'tr.time-entry', 3 |
1103 |
assert_select '.total-for-hours', :text => 'Hours: 12.90'
|
|
1103 |
assert_select '.total-for-hours', :text => 'Hours: 12:54'
|
|
1104 | 1104 |
assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries' |
1105 | 1105 |
end |
1106 | 1106 | |
... | ... | |
1116 | 1116 |
assert_response :success |
1117 | 1117 | |
1118 | 1118 |
assert_select 'tr.time-entry', 3 |
1119 |
assert_select '.total-for-hours', :text => 'Hours: 12.90'
|
|
1119 |
assert_select '.total-for-hours', :text => 'Hours: 12:54'
|
|
1120 | 1120 |
assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries' |
1121 | 1121 |
end |
1122 | 1122 | |
... | ... | |
1528 | 1528 |
get :index, :params => {:project_id => 1, :format => 'atom'} |
1529 | 1529 |
assert_response :success |
1530 | 1530 |
assert_equal 'application/atom+xml', @response.media_type |
1531 |
assert_select 'entry > title', :text => /7\.65 hours/
|
|
1531 |
assert_select 'entry > title', :text => /7:39 hours/
|
|
1532 | 1532 |
end |
1533 | 1533 | |
1534 | 1534 |
def test_index_at_project_level_should_include_csv_export_dialog |
test/functional/timelog_report_test.rb | ||
---|---|---|
71 | 71 |
def test_report_all_projects_one_criteria |
72 | 72 |
get :report, :params => {:columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']} |
73 | 73 |
assert_response :success |
74 |
assert_select 'tr.total td:last', :text => '8.65'
|
|
74 |
assert_select 'tr.total td:last', :text => '8:39'
|
|
75 | 75 |
assert_select 'tr td.name a[href=?]', '/projects/ecookbook', :text => 'eCookbook' |
76 | 76 |
end |
77 | 77 | |
78 | 78 |
def test_report_all_time |
79 | 79 |
get :report, :params => {:project_id => 1, :criteria => ['project', 'issue']} |
80 | 80 |
assert_response :success |
81 |
assert_select 'tr.total td:last', :text => '162.90'
|
|
81 |
assert_select 'tr.total td:last', :text => '162:54'
|
|
82 | 82 |
end |
83 | 83 | |
84 | 84 |
def test_report_all_time_by_day |
85 | 85 |
get :report, :params => {:project_id => 1, :criteria => ['project', 'issue'], :columns => 'day'} |
86 | 86 |
assert_response :success |
87 |
assert_select 'tr.total td:last', :text => '162.90'
|
|
87 |
assert_select 'tr.total td:last', :text => '162:54'
|
|
88 | 88 |
assert_select 'th', :text => '2007-03-12' |
89 | 89 |
end |
90 | 90 | |
91 | 91 |
def test_report_one_criteria |
92 | 92 |
get :report, :params => {:project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']} |
93 | 93 |
assert_response :success |
94 |
assert_select 'tr.total td:last', :text => '8.65'
|
|
94 |
assert_select 'tr.total td:last', :text => '8:39'
|
|
95 | 95 |
end |
96 | 96 | |
97 | 97 |
def test_report_two_criteria |
98 | 98 |
get :report, :params => {:project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]} |
99 | 99 |
assert_response :success |
100 |
assert_select 'tr.total td:last', :text => '162.90'
|
|
100 |
assert_select 'tr.total td:last', :text => '162:54'
|
|
101 | 101 |
end |
102 | 102 | |
103 | 103 |
def test_report_should_show_locked_users |
... | ... | |
151 | 151 |
def test_report_one_day |
152 | 152 |
get :report, :params => {:project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]} |
153 | 153 |
assert_response :success |
154 |
assert_select 'tr.total td:last', :text => '4.25'
|
|
154 |
assert_select 'tr.total td:last', :text => '4:15'
|
|
155 | 155 |
end |
156 | 156 | |
157 | 157 |
def test_report_by_week_should_use_commercial_year |
... | ... | |
173 | 173 |
end |
174 | 174 |
assert_select '#time-report tbody tr' do |
175 | 175 |
assert_select 'td:nth-child(1)', :text => 'eCookbook' |
176 |
assert_select 'td:nth-child(2)', :text => '2.00'
|
|
177 |
assert_select 'td:nth-child(3)', :text => '12.00'
|
|
178 |
assert_select 'td:nth-child(4)', :text => '16.00'
|
|
179 |
assert_select 'td:nth-child(5)', :text => '30.00' # Total
|
|
176 |
assert_select 'td:nth-child(2)', :text => '2:00'
|
|
177 |
assert_select 'td:nth-child(3)', :text => '12:00'
|
|
178 |
assert_select 'td:nth-child(4)', :text => '16:00'
|
|
179 |
assert_select 'td:nth-child(5)', :text => '30:00' # Total
|
|
180 | 180 |
end |
181 | 181 |
end |
182 | 182 | |
... | ... | |
195 | 195 |
get :report, :params => {:criteria => ['cf_1', 'cf_3', 'cf_7']} |
196 | 196 |
assert_response :success |
197 | 197 | |
198 |
assert_select 'tr.total td:last', :text => '162.90'
|
|
198 |
assert_select 'tr.total td:last', :text => '162:54'
|
|
199 | 199 | |
200 | 200 |
# Custom fields columns |
201 | 201 |
assert_select 'th', :text => 'Database' |
... | ... | |
205 | 205 |
# Custom field row |
206 | 206 |
assert_select 'tr' do |
207 | 207 |
assert_select 'td', :text => 'MySQL' |
208 |
assert_select 'td.hours', :text => '1.00'
|
|
208 |
assert_select 'td.hours', :text => '1:00'
|
|
209 | 209 |
end |
210 | 210 |
end |
211 | 211 |
test/functional/versions_controller_test.rb | ||
---|---|---|
162 | 162 |
assert_select 'a', :text => '1 open' |
163 | 163 |
end |
164 | 164 | |
165 |
assert_select '.time-tracking td.total-hours a:first-child', :text => '2.00 hours'
|
|
165 |
assert_select '.time-tracking td.total-hours a:first-child', :text => '2:00 hours'
|
|
166 | 166 |
end |
167 | 167 | |
168 | 168 |
def test_show_should_link_to_spent_time_on_version |
... | ... | |
173 | 173 |
get :show, :params => {:id => version.id} |
174 | 174 |
assert_response :success |
175 | 175 | |
176 |
assert_select '.total-hours', :text => '7.20 hours'
|
|
176 |
assert_select '.total-hours', :text => '7:12 hours'
|
|
177 | 177 |
assert_select '.total-hours a[href=?]', "/projects/ecookbook/time_entries?issue.fixed_version_id=#{version.id}&set_filter=1" |
178 | 178 |
end |
179 | 179 |
test/helpers/issues_helper_test.rb | ||
---|---|---|
204 | 204 |
test 'show_detail should show old and new values with a estimated hours attribute' do |
205 | 205 |
detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', |
206 | 206 |
:old_value => '5', :value => '6.3') |
207 |
assert_match '5.00', show_detail(detail, true)
|
|
208 |
assert_match '6.30', show_detail(detail, true)
|
|
207 |
assert_match '5:00', show_detail(detail, true)
|
|
208 |
assert_match '6:18', show_detail(detail, true)
|
|
209 | 209 |
end |
210 | 210 | |
211 | 211 |
test 'show_detail should not show values with a description attribute' do |
test/unit/lib/redmine/i18n_test.rb | ||
---|---|---|
158 | 158 | |
159 | 159 |
def test_l_hours_short |
160 | 160 |
set_language_if_valid 'en' |
161 |
assert_equal '2.00 h', l_hours_short(2.0)
|
|
161 |
assert_equal '2:00 h', l_hours_short(2.0)
|
|
162 | 162 |
end |
163 | 163 | |
164 | 164 |
def test_number_to_currency_default |
test/unit/lib/redmine/views/labelled_form_builder_test.rb | ||
---|---|---|
35 | 35 |
entry.validate |
36 | 36 | |
37 | 37 |
labelled_form_for(entry) do |f| |
38 |
assert_include 'value="2.50"', f.hours_field(:hours)
|
|
38 |
assert_include 'value="2:30"', f.hours_field(:hours)
|
|
39 | 39 |
end |
40 | 40 |
end |
41 | 41 |