@@ -44,24 +44,40 @@ def test_that_error_on_checkout_is_propagated
4444 end
4545 end
4646
47+ def test_that_error_on_locating_files_is_propagated
48+ file_strategy = file_strategy_stub ( locate_files_success : false )
49+ assert_raises ( TmpDir ::FileError ) do
50+ subject ( file_strategy :) . call
51+ end
52+ end
53+
54+ def test_that_main_returns_dir_and_sha_and_changes
55+ result = subject . call
56+
57+ refute_empty result [ :dir ]
58+ refute_empty result [ :sha ]
59+ refute_empty result [ :changes ]
60+ end
61+
4762 private
4863
4964 def subject ( folder : 'x' , revision : 'HEAD' , file_strategy : file_strategy_stub , git_strategy : git_strategy_stub )
5065 Main . new ( folder :, revision :, file_strategy :, git_strategy :)
5166 end
5267
53- def file_strategy_stub ( dir_exists : true , create_success : true )
54- FileStrategyStub . new ( dir_exists , create_success )
68+ def file_strategy_stub ( dir_exists : true , create_success : true , locate_files_success : true )
69+ FileStrategyStub . new ( dir_exists , create_success , locate_files_success )
5570 end
5671
5772 def git_strategy_stub ( revision_exists : true , diff_success : true , checkout_success : true )
5873 GitStrategyStub . new ( revision_exists , diff_success , checkout_success )
5974 end
6075
6176 class FileStrategyStub
62- def initialize ( dir_exists , create_success )
77+ def initialize ( dir_exists , create_success , locate_files_success )
6378 @dir_exists = dir_exists
6479 @create_success = create_success
80+ @locate_files_success = locate_files_success
6581 end
6682
6783 def dir_exists? ( _folder )
@@ -73,6 +89,12 @@ def create_tmp_dir(_sha)
7389
7490 'some_tpm_dir'
7591 end
92+
93+ def locate_files ( _dir , _changes )
94+ raise TmpDir ::FileError unless @locate_files_success
95+
96+ [ { } , { } ]
97+ end
7698 end
7799
78100 class GitStrategyStub
0 commit comments