Makes spent time column available on the issue list (#971).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8073 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -537,6 +537,13 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
get :index, :group_by => 'author', :sort => 'priority'
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_index_group_by_spent_hours
|
||||
get :index, :group_by => 'author', :sort => 'spent_hours:desc'
|
||||
assert_response :success
|
||||
hours = assigns(:issues).collect(&:spent_hours)
|
||||
assert_equal hours.sort.reverse, hours
|
||||
end
|
||||
|
||||
def test_index_with_columns
|
||||
columns = ['tracker', 'subject', 'assigned_to']
|
||||
@@ -615,6 +622,22 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
}
|
||||
end
|
||||
|
||||
def test_index_with_spent_hours_column
|
||||
get :index, :set_filter => 1, :c => %w(subject spent_hours)
|
||||
|
||||
assert_tag 'tr', :attributes => {:id => 'issue-3'},
|
||||
:child => {
|
||||
:tag => 'td', :attributes => {:class => /spent_hours/}, :content => '1.00'
|
||||
}
|
||||
end
|
||||
|
||||
def test_index_should_not_show_spent_hours_column_without_permission
|
||||
Role.anonymous.remove_permission! :view_time_entries
|
||||
get :index, :set_filter => 1, :c => %w(subject spent_hours)
|
||||
|
||||
assert_no_tag 'td', :attributes => {:class => /spent_hours/}
|
||||
end
|
||||
|
||||
def test_index_with_fixed_version
|
||||
get :index, :set_filter => 1, :c => %w(fixed_version)
|
||||
assert_tag 'td', :attributes => {:class => /fixed_version/},
|
||||
|
||||
@@ -423,6 +423,13 @@ class QueryTest < ActiveSupport::TestCase
|
||||
assert q.has_column?(c)
|
||||
end
|
||||
|
||||
def test_query_should_preload_spent_hours
|
||||
q = Query.new(:name => '_', :column_names => [:subject, :spent_hours])
|
||||
assert q.has_column?(:spent_hours)
|
||||
issues = q.issues
|
||||
assert_not_nil issues.first.instance_variable_get("@spent_hours")
|
||||
end
|
||||
|
||||
def test_groupable_columns_should_include_custom_fields
|
||||
q = Query.new
|
||||
assert q.groupable_columns.detect {|c| c.is_a? QueryCustomFieldColumn}
|
||||
|
||||
Reference in New Issue
Block a user