1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 module RepositoryStubHelper
6 # Supply some fake git content.
7 def stub_repo_content opts={}
8 fakesha1 = opts[:sha1] || 'abcdefabcdefabcdefabcdefabcdefabcdefabcd'
9 fakefilename = opts[:filename] || 'COPYING'
10 fakefilesrc = File.expand_path('../../../../../'+fakefilename, __FILE__)
11 fakefile = File.read fakefilesrc
13 commit abcdefabcdefabcdefabcdefabcdefabcdefabcd
14 Author: Fake R <fake@example.com>
15 Date: Wed Apr 1 11:59:59 2015 -0400
20 Repository.any_instance.stubs(:ls_tree_lr).with(fakesha1).returns <<-EOS
21 100644 blob eec475862e6ec2a87554e0fca90697e87f441bf5 226 .gitignore
22 100644 blob acbd7523ed49f01217874965aa3180cccec89d61 625 COPYING
23 100644 blob d645695673349e3947e8e5ae42332d0ac3164cd7 11358 LICENSE-2.0.txt
24 100644 blob c7a36c355b4a2b94dfab45c9748330022a788c91 622 README
25 100644 blob dba13ed2ddf783ee8118c6a581dbf75305f816a3 34520 agpl-3.0.txt
26 100644 blob 9bef02bbfda670595750fd99a4461005ce5b8f12 695 apps/workbench/.gitignore
27 100644 blob b51f674d90f68bfb50d9304068f915e42b04aea4 2249 apps/workbench/Gemfile
28 100644 blob b51f674d90f68bfb50d9304068f915e42b04aea4 2249 apps/workbench/Gemfile
30 Repository.any_instance.
31 stubs(:cat_file).with(fakesha1, fakefilename).returns fakefile
32 Repository.any_instance.
33 stubs(:show).with(fakesha1).returns fakecommit
34 return fakesha1, fakecommit, fakefile