Skip to content

Commit 52d2a40

Browse files
committed
[CodeExtractorReinsertTest] Support custom commits
In .apply_new_commits_on_extracted_repo, add the ability to pass a block, which will then instead be used instead of what was used by default in the method. This allows for taking advantage of the new `.merge` DSL for representing so more real-world extracted repos
1 parent 2059b75 commit 52d2a40

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/code_extractor_reinsert_test.rb

+11-7
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,23 @@ def perform_merges_of_extracted_code
157157
original_repo.remotes['origin'].push [original_repo.head.name]
158158
end
159159

160-
def apply_new_commits_on_extracted_repo
160+
def apply_new_commits_on_extracted_repo &block
161161
@new_upstream_dir = File.join @sandbox_dir, "new_upstream.git"
162162
@cloned_extractions_dir = File.join @sandbox_dir, "cloned_extractions.git"
163163

164-
CodeExtractor::TestRepo.clone_at extracted_dir, @cloned_extractions_dir do
165-
checkout_b 'master', 'origin/master'
164+
unless block_given?
165+
block = proc do
166+
checkout_b 'master', 'origin/master'
166167

167-
update_file "foo/bar", "Updated Bar Content"
168-
commit "update bar content"
168+
update_file "foo/bar", "Updated Bar Content"
169+
commit "update bar content"
169170

170-
update_file "foo/baz", "Baz Content"
171-
commit "add new baz"
171+
update_file "foo/baz", "Baz Content"
172+
commit "add new baz"
173+
end
172174
end
175+
176+
CodeExtractor::TestRepo.clone_at(extracted_dir, @cloned_extractions_dir, &block)
173177
end
174178

175179
# Update the configuration for the (second) extraction

0 commit comments

Comments
 (0)