1 module RepositoryStubHelper
2 # Supply some fake git content.
3 def stub_repo_content opts={}
4 fakesha1 = opts[:sha1] || 'abcdefabcdefabcdefabcdefabcdefabcdefabcd'
5 fakefilename = opts[:filename] || 'COPYING'
6 fakefilesrc = File.expand_path('../../../../../'+fakefilename, __FILE__)
7 fakefile = File.read fakefilesrc
9 commit abcdefabcdefabcdefabcdefabcdefabcdefabcd
10 Author: Fake R <fake@example.com>
11 Date: Wed Apr 1 11:59:59 2015 -0400
16 Repository.any_instance.stubs(:ls_tree_lr).with(fakesha1).returns <<-EOS
17 100644 blob eec475862e6ec2a87554e0fca90697e87f441bf5 226 .gitignore
18 100644 blob acbd7523ed49f01217874965aa3180cccec89d61 625 COPYING
19 100644 blob d645695673349e3947e8e5ae42332d0ac3164cd7 11358 LICENSE-2.0.txt
20 100644 blob c7a36c355b4a2b94dfab45c9748330022a788c91 622 README
21 100644 blob dba13ed2ddf783ee8118c6a581dbf75305f816a3 34520 agpl-3.0.txt
22 100644 blob 9bef02bbfda670595750fd99a4461005ce5b8f12 695 apps/workbench/.gitignore
23 100644 blob b51f674d90f68bfb50d9304068f915e42b04aea4 2249 apps/workbench/Gemfile
24 100644 blob b51f674d90f68bfb50d9304068f915e42b04aea4 2249 apps/workbench/Gemfile
25 100755 blob cdd5ebaff27781f93ab85e484410c0ce9e97770f 1012 crunch_scripts/hash
27 Repository.any_instance.
28 stubs(:cat_file).with(fakesha1, fakefilename).returns fakefile
29 Repository.any_instance.
30 stubs(:show).with(fakesha1).returns fakecommit
31 return fakesha1, fakecommit, fakefile