[
['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
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