X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/eeebd1e25974beff2455c96100532aaa4dae68fb..f6089c82da72f331ba5a44874ce267b18bcaf557:/services/api/test/unit/collection_test.rb diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb index d066fe3173..59f9d3d41a 100644 --- a/services/api/test/unit/collection_test.rb +++ b/services/api/test/unit/collection_test.rb @@ -93,7 +93,10 @@ class CollectionTest < ActiveSupport::TestCase [ ['foo', true], ['foo bar', false], # no collection matching both + ['foo&bar', false], # no collection matching both + ['foo|bar', true], # works only no spaces between the words ['Gnu public', true], # both prefixes found, though not consecutively + ['Gnu&public', true], # both prefixes found, though not consecutively ['file4', true], # prefix match ['file4.txt', true], # whole string match ['filex', false], # no such prefix @@ -109,9 +112,19 @@ class CollectionTest < ActiveSupport::TestCase results = Collection.where("#{Collection.full_text_tsvector} @@ to_tsquery(?)", "#{search_filters}") if expect_results - assert_equal true, results.length>0, "No results found for '#{search_filter}'" + refute_empty results else - assert_equal 0, results.length, "Found #{results.length} results for '#{search_filter}'" + assert_empty results + end + end + end + + [0, 2, 4, nil].each do |ask| + test "replication_desired reports #{ask or 2} if redundancy is #{ask}" do + act_as_user users(:active) do + c = collections(:collection_owned_by_active) + c.update_attributes redundancy: ask + assert_equal (ask or 2), c.replication_desired end end end