spec/unit/berkshelf/git_spec.rb in berkshelf-2.0.18 vs spec/unit/berkshelf/git_spec.rb in berkshelf-3.0.0.beta1
- old
+ new
@@ -16,11 +16,11 @@
}.to raise_error(Berkshelf::GitNotFound)
end
end
describe '.clone' do
- let(:target) { clone_target_for('nginx') }
+ let(:target) { clone_path('nginx') }
it 'clones the repository to the target path' do
origin_uri = git_origin_for('nginx')
Berkshelf::Git.clone(origin_uri, target)
@@ -28,11 +28,11 @@
expect(target).to be_directory
end
end
describe '.checkout' do
- let(:repo_path) { clone_target_for('nginx') }
+ let(:repo_path) { clone_path('nginx') }
let(:repo) {
origin_uri = git_origin_for('nginx', tags: ['1.0.1', '1.0.2'], branches: ['topic', 'next_topic'])
git.clone(origin_uri, repo_path)
}
@@ -46,11 +46,11 @@
end
end
end
context 'with sha commit id' do
- let(:ref) { git_sha_for_ref('nginx', '1.0.1') }
+ let(:ref) { sha_for_ref('nginx', '1.0.1') }
it_behaves_like 'able to checkout git ref'
end
context 'with tags' do
@@ -61,11 +61,11 @@
context 'after checking out another tag' do
let(:other_tag) { '1.0.2' }
before do
git.checkout(repo, other_tag)
Dir.chdir repo_path do
- run! "echo 'uncommitted change' >> content_file"
+ shell_out "echo 'uncommitted change' >> content_file"
end
end
it_behaves_like 'able to checkout git ref'
end
@@ -79,54 +79,54 @@
context 'after checking out another branch' do
let(:other_branch) { 'next_topic' }
before do
git.checkout(repo, other_branch)
Dir.chdir repo_path do
- run! "echo 'uncommitted change' >> content_file"
+ shell_out "echo 'uncommitted change' >> content_file"
end
end
it_behaves_like 'able to checkout git ref', 'origin/topic'
end
end
end
describe '.rev_parse' do
- let(:repo_path) { clone_target_for('nginx') }
+ let(:repo_path) { clone_path('nginx') }
before(:each) do |example|
origin_uri = git_origin_for('nginx', tags: ['1.1.1'])
Berkshelf::Git.clone(origin_uri, repo_path)
- Berkshelf::Git.checkout(repo_path, git_sha_for_ref('nginx', '1.1.1'))
+ Berkshelf::Git.checkout(repo_path, sha_for_ref('nginx', '1.1.1'))
end
it 'returns the ref for HEAD' do
rev = Berkshelf::Git.rev_parse(repo_path)
- ref = git_sha_for_ref('nginx', '1.1.1')
+ ref = sha_for_ref('nginx', '1.1.1')
expect(rev).to eql(ref)
end
end
describe '.show_ref' do
- let(:repo_path) { clone_target_for('nginx') }
+ let(:repo_path) { clone_path('nginx') }
let(:tags) { ['1.0.1'] }
let(:branches) { ['topic'] }
let!(:repo) {
origin_uri = git_origin_for('nginx', tags: tags, branches: branches)
git.clone(origin_uri, repo_path)
}
it 'returns the commit id for the given tag' do
show = git.show_ref(repo_path, '1.0.1')
- ref = git_sha_for_ref('nginx', '1.0.1')
+ ref = sha_for_ref('nginx', '1.0.1')
expect(show).to eq(ref)
end
it 'returns the commit id for the given branch' do
show = git.show_ref(repo_path, 'topic')
- ref = git_sha_for_ref('nginx', 'topic')
+ ref = sha_for_ref('nginx', 'topic')
expect(show).to eq(ref)
end
context 'with an ambiguous ref' do
let(:tags) { ['topic'] }
@@ -139,35 +139,35 @@
end
end
end
describe '.revision_from_ref' do
- let(:repo_path) { clone_target_for('nginx') }
+ let(:repo_path) { clone_path('nginx') }
let(:tags) { ['1.0.1'] }
let(:branches) { ['topic'] }
let!(:repo) {
origin_uri = git_origin_for('nginx', tags: tags, branches: branches)
git.clone(origin_uri, repo_path)
}
context 'with sha commit id' do
- let(:revision) { git_sha_for_ref('nginx', '1.0.1') }
+ let(:revision) { sha_for_ref('nginx', '1.0.1') }
it 'returns the passed revision' do
rev = git.revision_from_ref(repo_path, revision)
expect(rev).to eq(revision)
end
end
context 'with tag' do
- let(:revision) { git_sha_for_ref('nginx', '1.0.1') }
+ let(:revision) { sha_for_ref('nginx', '1.0.1') }
it 'returns the revision' do
rev = git.revision_from_ref(repo_path, '1.0.1')
expect(rev).to eq(revision)
end
end
context 'with branch' do
- let(:revision) { git_sha_for_ref('nginx', 'topic') }
+ let(:revision) { sha_for_ref('nginx', 'topic') }
it 'returns the revision' do
rev = git.revision_from_ref(repo_path, 'topic')
expect(rev).to eq(revision)
end
end