spec/unit/puppetfile_spec.rb in r10k-3.10.0 vs spec/unit/puppetfile_spec.rb in r10k-3.11.0
- old
+ new
@@ -8,20 +8,39 @@
'/some/nonexistent/basedir',
{puppetfile_name: 'Puppetfile.r10k'}
)
end
- describe "a custom puppetfile Puppetfile.r10k" do
+ describe "a custom puppetfile_name" do
it "is the basedir joined with '/Puppetfile.r10k' path" do
expect(subject.puppetfile_path).to eq '/some/nonexistent/basedir/Puppetfile.r10k'
end
end
end
describe R10K::Puppetfile do
+ describe "a custom relative puppetfile_path" do
+ it "is the basedir joined with the puppetfile_path" do
+ relative_subject = described_class.new('/some/nonexistent/basedir',
+ {puppetfile_path: 'relative/Puppetfile'})
+ expect(relative_subject.puppetfile_path).to eq '/some/nonexistent/basedir/relative/Puppetfile'
+ end
+ end
+
+ describe "a custom absolute puppetfile_path" do
+ it "is the puppetfile_path as given" do
+ absolute_subject = described_class.new('/some/nonexistent/basedir',
+ {puppetfile_path: '/some/absolute/custom/Puppetfile'})
+ expect(absolute_subject.puppetfile_path).to eq '/some/absolute/custom/Puppetfile'
+ end
+ end
+end
+
+describe R10K::Puppetfile do
+
subject do
described_class.new( '/some/nonexistent/basedir', {})
end
describe "backwards compatibility with older calling conventions" do
@@ -69,9 +88,20 @@
describe "loading a Puppetfile" do
context 'using load' do
it "returns the loaded content" do
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
+ subject = described_class.new(path, {})
+
+ loaded_content = subject.load
+ expect(loaded_content).to be_an_instance_of(Hash)
+
+ has_some_data = loaded_content.values.none?(&:empty?)
+ expect(has_some_data).to be true
+ end
+
+ it "handles a relative basedir" do
+ path = File.join('spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
subject = described_class.new(path, {})
loaded_content = subject.load
expect(loaded_content).to be_an_instance_of(Hash)