1 require 'minitest/autorun'
3 require 'active_support/core_ext'
6 class TestCollectionCreate < Minitest::Test
10 def test_small_collection
11 uuid = Digest::MD5.hexdigest(foo_manifest) + '+' + foo_manifest.size.to_s
12 out, err = capture_subprocess_io do
13 assert_arv('--format', 'uuid', 'collection', 'create', '--collection', {
15 manifest_text: foo_manifest
18 assert /^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out)
22 def test_read_resource_object_from_file
23 tempfile = Tempfile.new('collection')
25 tempfile.write({manifest_text: foo_manifest}.to_json)
27 out, err = capture_subprocess_io do
28 assert_arv('--format', 'uuid',
29 'collection', 'create', '--collection', tempfile.path)
31 assert /^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out)
40 expect = case args.first
47 system(['./bin/arv', 'arv'], *args),
48 "`arv #{args.join ' '}` " +
49 "should exit #{if expect then 0 else 'non-zero' end}")
53 ". #{Digest::MD5.hexdigest('foo')}+3 0:3:foo\n"