Skip to content

Commit

Permalink
#1417i tests
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jan 18, 2023
1 parent 9e2f71a commit 61c0aab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/dmsf_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def statement
"SELECT ct.id FROM dmsf_folders ct LEFT OUTER JOIN custom_values ON custom_values.customized_type='DmsfFolder' AND custom_values.customized_id=ct.id AND custom_values.custom_field_id=",
'SELECT custom_values.customized_id FROM custom_values WHERE custom_values.customized_type=dmsf_folders.customized_type AND custom_values.customized_id=dmsf_folders.customized_id AND custom_values.custom_field_id=')
sql_cf.gsub! 'WHERE dmsf_folders.id = ct.id AND (', 'AND '
sql_cf.gsub!(/\)$/, '')
sql_cf.gsub! /\)$/, ''
filters_clauses << sql_cf
else
filters_clauses << '(' + sql_for_field(field, operator, v, queried_table_name, field) + ')'
Expand Down
10 changes: 10 additions & 0 deletions test/functional/dmsf_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ def test_show_filters_not_found
assert_select 'a', text: @file10.title, count: 0
end

def test_show_filters_custom_field
get :show, params: { id: @project1.id, set_filter: '1', f: ['cf_21', ''], op: { 'cf_21' => '=' },
v: { 'cf_21' => ['User documentation']} }
assert_response :success
# Folder 1 with Tag=User documentation
assert_select 'a', text: @folder1.title
# Other document/folders are not present
assert_select 'a', text: @file10.title, count: 0
end

def test_show_without_file_manipulation
@role_manager.remove_permission! :file_manipulation
get :show, params: { id: @project1.id }
Expand Down

0 comments on commit 61c0aab

Please sign in to comment.