spec/unit/deployment/environment_spec.rb in r10k-1.2.4 vs spec/unit/deployment/environment_spec.rb in r10k-1.3.0rc1
- old
+ new
@@ -1,24 +1,25 @@
require 'spec_helper'
require 'r10k/deployment/environment'
describe R10K::Deployment::Environment do
- let(:remote) { 'git://github.com/adrienthebo/r10k-fixture-repo' }
- let(:ref) { 'master' }
- describe 'dirname' do
- it 'uses the ref as the default dirname' do
- subject = described_class.new(ref, remote, '/tmp')
- subject.dirname.should == 'master'
- end
+ it "creates R10K::Environment::Git instances" do
+ subject = described_class.new('gitref', 'git://git-server.local/git-remote.git', '/some/nonexistent/dir')
+ expect(subject).to be_a_kind_of R10K::Environment::Git
+ end
- it 'uses the ref and a provided source name in the default dirname' do
- subject = described_class.new(ref, remote, '/tmp', nil, "the")
- subject.dirname.should == 'the_master'
- end
+ it "uses the ref as the dirname by default" do
+ subject = described_class.new('gitref', 'git://git-server.local/git-remote.git', '/some/nonexistent/dir')
+ expect(subject.dirname).to eq 'gitref'
+ end
- it 'allows a specific dirname to be set' do
- subject = described_class.new(ref, remote, '/tmp', 'sourcename_master')
- subject.dirname.should == 'sourcename_master'
- end
+ it "can specify an explicit dirname" do
+ subject = described_class.new('gitref', 'git://git-server.local/git-remote.git', '/some/nonexistent/dir', 'explicit-dirname')
+ expect(subject.dirname).to eq 'explicit-dirname'
+ end
+
+ it "supports prefixing for backwards compatibility" do
+ subject = described_class.new('gitref', 'git://git-server.local/git-remote.git', '/some/nonexistent/dir', nil, 'source')
+ expect(subject.dirname).to eq 'source_gitref'
end
end