X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/60501a83ead2f3c71144d3af842e714cb3f91000..fceecc54056fef8e91582422a7a805da0abc189d:/apps/workbench/test/controllers/actions_controller_test.rb diff --git a/apps/workbench/test/controllers/actions_controller_test.rb b/apps/workbench/test/controllers/actions_controller_test.rb index d8c17c9d82..e9063df0bd 100644 --- a/apps/workbench/test/controllers/actions_controller_test.rb +++ b/apps/workbench/test/controllers/actions_controller_test.rb @@ -33,13 +33,12 @@ class ActionsControllerTest < ActionController::TestCase use_token :active collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first manifest_text = collection['manifest_text'] - assert manifest_text.include?('foo'), 'Not found foo in new collection manifest text' - assert manifest_text.include?('bar'), 'Not found bar in new collection manifest text' - assert manifest_text.include?('baz'), 'Not found baz in new collection manifest text' - assert manifest_text.include?('0:0:file1 0:0:file2 0:0:file3'), - 'Not found 0:0:file1 0:0:file2 0:0:file3 in new collection manifest text' - assert manifest_text.include?('dir1/subdir'), 'Not found dir1/subdir in new collection manifest text' - assert manifest_text.include?('dir2'), 'Not found dir2 in new collection manifest text' + assert_includes(manifest_text, "foo") + assert_includes(manifest_text, "bar") + assert_includes(manifest_text, "baz") + assert_includes(manifest_text, "0:0:file1 0:0:file2 0:0:file3") + assert_includes(manifest_text, "dir1/subdir") + assert_includes(manifest_text, "dir2") end test "combine files with repeated names into new collection" do @@ -61,15 +60,13 @@ class ActionsControllerTest < ActionController::TestCase use_token :active collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first manifest_text = collection['manifest_text'] - assert manifest_text.include?('foo'), 'Not found foo in new collection manifest text' - assert manifest_text.include?('foo(1)'), 'Not found foo(1) in new collection manifest text' - assert manifest_text.include?('foo(2)'), 'Not found foo(2) in new collection manifest text' - assert manifest_text.include?('bar'), 'Not found bar in new collection manifest text' - assert manifest_text.include?('baz'), 'Not found baz in new collection manifest text' - assert manifest_text.include?('0:0:file1 0:0:file2 0:0:file3'), - 'Not found 0:0:file1 0:0:file2 0:0:file3 in new collection manifest text' - assert manifest_text.include?('dir1/subdir'), 'Not found dir1/subdir in new collection manifest text' - assert manifest_text.include?('dir2'), 'Not found dir2 in new collection manifest text' + assert_includes(manifest_text, "foo(1)") + assert_includes(manifest_text, "foo(2)") + assert_includes(manifest_text, "bar") + assert_includes(manifest_text, "baz") + assert_includes(manifest_text, "0:0:file1 0:0:file2 0:0:file3") + assert_includes(manifest_text, "dir1/subdir") + assert_includes(manifest_text, "dir2") end test "combine collections with repeated filenames in almost similar directories and expect files with proper suffixes" do @@ -97,19 +94,19 @@ class ActionsControllerTest < ActionController::TestCase streams.each do |stream| if stream.start_with? './dir1' # dir1 stream - assert stream.include?(':alice(1)'), 'Not found: alice(1) in dir1' - assert stream.include?(':alice.txt'), 'Not found: alice.txt in dir1' - assert stream.include?(':alice(1).txt'), 'Not found: alice(1).txt in dir1' - assert stream.include?(':bob.txt'), 'Not found: bob.txt in dir1' - assert stream.include?(':carol.txt'), 'Not found: carol.txt in dir1' + assert stream.include?(':alice(1)'), "Not found: alice(1) in dir1 in manifest text #{manifest_text}" + assert stream.include?(':alice.txt'), "Not found: alice.txt in dir1 in manifest text #{manifest_text}" + assert stream.include?(':alice(1).txt'), "Not found: alice(1).txt in dir1 in manifest text #{manifest_text}" + assert stream.include?(':bob.txt'), "Not found: bob.txt in dir1 in manifest text #{manifest_text}" + assert stream.include?(':carol.txt'), "Not found: carol.txt in dir1 in manifest text #{manifest_text}" elsif stream.start_with? './dir2' # dir2 stream - assert stream.include?(':alice.txt'), 'Not found: alice.txt in dir2' - assert stream.include?(':alice(1).txt'), 'Not found: alice(1).txt in dir2' + assert stream.include?(':alice.txt'), "Not found: alice.txt in dir2 in manifest text #{manifest_text}" + assert stream.include?(':alice(1).txt'), "Not found: alice(1).txt in dir2 in manifest text #{manifest_text}" elsif stream.start_with? '. ' # . stream - assert stream.include?(':foo'), 'Not found: foo in .' - assert stream.include?(':foo(1)'), 'Not found: foo(1) in .' + assert stream.include?(':foo'), "Not found: foo in . in manifest text #{manifest_text}" + assert stream.include?(':foo(1)'), "Not found: foo(1) in . in manifest text #{manifest_text}" end end end @@ -159,8 +156,8 @@ class ActionsControllerTest < ActionController::TestCase manifest_text = collection['manifest_text'] streams = manifest_text.split "\n" - assert_equal 1, streams.length - assert manifest_text.include?('foo'), 'Found foo in new collection manifest text' - assert manifest_text.include?('foo(1)'), 'Found foo(1) in new collection manifest text' + assert_equal 1, streams.length, "Incorrect number of streams in #{manifest_text}" + assert manifest_text.include?('foo'), "Not found foo in new collection manifest text #{manifest_text}" + assert manifest_text.include?('foo(1)'), "Not found foo(1) in new collection manifest text #{manifest_text}" end end