utils/git: cherry-pick test
This commit is contained in:
parent
d09ebf428f
commit
146664b45f
@ -34,6 +34,12 @@ describe Utils::Git do
|
|||||||
File.open("LICENSE.txt", "w") { |f| f.write("LICENSE") }
|
File.open("LICENSE.txt", "w") { |f| f.write("LICENSE") }
|
||||||
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
||||||
system git, "commit", "-m", "'written to File'"
|
system git, "commit", "-m", "'written to File'"
|
||||||
|
|
||||||
|
File.open("LICENSE.txt", "w") { |f| f.write("test") }
|
||||||
|
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
||||||
|
system git, "commit", "-m", "'written to File'"
|
||||||
|
@cherry_pick_commit = `git rev-parse HEAD`
|
||||||
|
system git, "reset", "--hard", "HEAD^"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -43,8 +49,13 @@ describe Utils::Git do
|
|||||||
let(:files) { ["README.md", "LICENSE.txt"] }
|
let(:files) { ["README.md", "LICENSE.txt"] }
|
||||||
let(:files_hash1) { [@h3[0..6], ["LICENSE.txt"]] }
|
let(:files_hash1) { [@h3[0..6], ["LICENSE.txt"]] }
|
||||||
let(:files_hash2) { [@h2[0..6], ["README.md"]] }
|
let(:files_hash2) { [@h2[0..6], ["README.md"]] }
|
||||||
|
let(:cherry_pick_commit) { @cherry_pick_commit[0..6] }
|
||||||
|
|
||||||
describe "#cherry_pick!" do
|
describe "#cherry_pick!" do
|
||||||
|
it "can cherry pick a commit" do
|
||||||
|
expect(described_class.cherry_pick!(HOMEBREW_CACHE, cherry_pick_commit)).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
it "aborts when cherry picking an existing hash" do
|
it "aborts when cherry picking an existing hash" do
|
||||||
expect {
|
expect {
|
||||||
described_class.cherry_pick!(HOMEBREW_CACHE, file_hash1)
|
described_class.cherry_pick!(HOMEBREW_CACHE, file_hash1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user