mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 05:16:32 +02:00
Refactor: makes issue id a regular QueryColumn.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11447 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -380,7 +380,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_equal 'text/csv; header=present', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size
|
||||
assert_equal assigns(:query).columns.size, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_with_project
|
||||
@@ -397,7 +397,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_equal 'text/csv; header=present', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size
|
||||
assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_with_spent_time_column
|
||||
@@ -416,9 +416,9 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:issues)
|
||||
assert_equal 'text/csv; header=present', @response.content_type
|
||||
assert @response.body.starts_with?("#,")
|
||||
lines = @response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).available_inline_columns.size + 1, lines[0].split(',').size
|
||||
assert_match /\A#,/, response.body
|
||||
lines = response.body.chomp.split("\n")
|
||||
assert_equal assigns(:query).available_inline_columns.size, lines[0].split(',').size
|
||||
end
|
||||
|
||||
def test_index_csv_with_multi_column_field
|
||||
@@ -708,12 +708,12 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
# query should use specified columns
|
||||
query = assigns(:query)
|
||||
assert_kind_of IssueQuery, query
|
||||
assert_equal [:project, :tracker, :subject, :assigned_to], query.columns.map(&:name)
|
||||
assert_equal [:id, :project, :tracker, :subject, :assigned_to], query.columns.map(&:name)
|
||||
end
|
||||
|
||||
def test_index_without_project_and_explicit_default_columns_should_not_add_project_column
|
||||
Setting.issue_list_default_columns = ['tracker', 'subject', 'assigned_to']
|
||||
columns = ['tracker', 'subject', 'assigned_to']
|
||||
columns = ['id', 'tracker', 'subject', 'assigned_to']
|
||||
get :index, :set_filter => 1, :c => columns
|
||||
|
||||
# query should use specified columns
|
||||
|
||||
@@ -114,7 +114,7 @@ class QueriesControllerTest < ActionController::TestCase
|
||||
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
|
||||
assert !q.is_public?
|
||||
assert !q.has_default_columns?
|
||||
assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
|
||||
assert_equal [:id, :tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
|
||||
assert q.valid?
|
||||
end
|
||||
|
||||
|
||||
@@ -750,16 +750,34 @@ class QueryTest < ActiveSupport::TestCase
|
||||
def test_set_column_names
|
||||
q = IssueQuery.new
|
||||
q.column_names = ['tracker', :subject, '', 'unknonw_column']
|
||||
assert_equal [:tracker, :subject], q.columns.collect {|c| c.name}
|
||||
c = q.columns.first
|
||||
assert q.has_column?(c)
|
||||
assert_equal [:id, :tracker, :subject], q.columns.collect {|c| c.name}
|
||||
end
|
||||
|
||||
def test_has_column_should_accept_a_column_name
|
||||
q = IssueQuery.new
|
||||
q.column_names = ['tracker', :subject]
|
||||
assert q.has_column?(:tracker)
|
||||
assert !q.has_column?(:category)
|
||||
end
|
||||
|
||||
def test_has_column_should_accept_a_column
|
||||
q = IssueQuery.new
|
||||
q.column_names = ['tracker', :subject]
|
||||
|
||||
tracker_column = q.available_columns.detect {|c| c.name==:tracker}
|
||||
assert_kind_of QueryColumn, tracker_column
|
||||
category_column = q.available_columns.detect {|c| c.name==:category}
|
||||
assert_kind_of QueryColumn, category_column
|
||||
|
||||
assert q.has_column?(tracker_column)
|
||||
assert !q.has_column?(category_column)
|
||||
end
|
||||
|
||||
def test_inline_and_block_columns
|
||||
q = IssueQuery.new
|
||||
q.column_names = ['subject', 'description', 'tracker']
|
||||
|
||||
assert_equal [:subject, :tracker], q.inline_columns.map(&:name)
|
||||
assert_equal [:id, :subject, :tracker], q.inline_columns.map(&:name)
|
||||
assert_equal [:description], q.block_columns.map(&:name)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user