@@ -679,7 +679,8 class Query < ActiveRecord::Base | |||
|
679 | 679 | end |
|
680 | 680 | |
|
681 | 681 | def has_column?(column) |
|
682 |
|
|
|
682 | name = column.is_a?(QueryColumn) ? column.name : column | |
|
683 | columns.detect {|c| c.name == name} | |
|
683 | 684 | end |
|
684 | 685 | |
|
685 | 686 | def has_custom_field_column? |
@@ -1170,6 +1170,14 class QueryTest < ActiveSupport::TestCase | |||
|
1170 | 1170 | assert !q.has_column?(category_column) |
|
1171 | 1171 | end |
|
1172 | 1172 | |
|
1173 | def test_has_column_should_return_true_for_default_column | |
|
1174 | with_settings :issue_list_default_columns => %w(tracker subject) do | |
|
1175 | q = IssueQuery.new | |
|
1176 | assert q.has_column?(:tracker) | |
|
1177 | assert !q.has_column?(:category) | |
|
1178 | end | |
|
1179 | end | |
|
1180 | ||
|
1173 | 1181 | def test_inline_and_block_columns |
|
1174 | 1182 | q = IssueQuery.new |
|
1175 | 1183 | q.column_names = ['subject', 'description', 'tracker'] |
General Comments 0
You need to be logged in to leave comments.
Login now