Defect #37925 ยป fix_query_display_type.patch
| app/models/query.rb | ||
|---|---|---|
| 1065 | 1065 |
end |
| 1066 | 1066 | |
| 1067 | 1067 |
def display_type=(type) |
| 1068 |
unless type || self.available_display_types.include?(type)
|
|
| 1068 |
unless type && self.available_display_types.include?(type)
|
|
| 1069 | 1069 |
type = self.available_display_types.first |
| 1070 | 1070 |
end |
| 1071 | 1071 |
options[:display_type] = type |
| test/unit/query_test.rb | ||
|---|---|---|
| 2880 | 2880 | |
| 2881 | 2881 |
assert_equal 1, query.issue_count |
| 2882 | 2882 |
end |
| 2883 | ||
| 2884 |
def test_display_type_should_accept_known_types |
|
| 2885 |
query = ProjectQuery.new(:name => '_') |
|
| 2886 |
query.display_type = 'list' |
|
| 2887 | ||
| 2888 |
assert_equal 'list', query.display_type |
|
| 2889 |
end |
|
| 2890 | ||
| 2891 |
def test_display_type_should_not_accept_unknown_types |
|
| 2892 |
query = ProjectQuery.new(:name => '_') |
|
| 2893 |
query.display_type = 'invalid' |
|
| 2894 | ||
| 2895 |
assert_equal 'board', query.display_type |
|
| 2896 |
end |
|
| 2883 | 2897 |
end |