spec/unit/module/svn_spec.rb in r10k-1.3.5 vs spec/unit/module/svn_spec.rb in r10k-1.4.0
- old
+ new
@@ -11,25 +11,61 @@
implements = described_class.implement?('r10k-fixture-repo', :svn => 'https://github.com/adrienthebo/r10k-fixture-repo')
expect(implements).to eq true
end
end
+ describe "path variables" do
+ it "uses the module name as the name" do
+ svn = described_class.new('foo', '/moduledir', :rev => 'r10')
+ expect(svn.name).to eq 'foo'
+ expect(svn.owner).to be_nil
+ expect(svn.dirname).to eq '/moduledir'
+ expect(svn.path).to eq Pathname.new('/moduledir/foo')
+ end
+
+ it "does not include the owner in the path" do
+ svn = described_class.new('bar/foo', '/moduledir', :rev => 'r10')
+ expect(svn.name).to eq 'foo'
+ expect(svn.owner).to eq 'bar'
+ expect(svn.dirname).to eq '/moduledir'
+ expect(svn.path).to eq Pathname.new('/moduledir/foo')
+ end
+ end
+
+
describe "instantiating based on Puppetfile configuration" do
it "can specify a revision with the :rev key" do
svn = described_class.new('foo', '/moduledir', :rev => 'r10')
expect(svn.expected_revision).to eq 'r10'
end
it "can specify a revision with the :revision key" do
svn = described_class.new('foo', '/moduledir', :revision => 'r10')
expect(svn.expected_revision).to eq 'r10'
end
+ end
- it "can specify a path within the SVN repo" do
- svn = described_class.new('foo', '/moduledir', :svn_path => 'branches/something/foo')
- expect(svn.svn_path).to eq 'branches/something/foo'
+ describe "properties" do
+ subject { described_class.new('foo', '/moduledir', :svn => 'https://github.com/adrienthebo/r10k-fixture-repo', :rev => 123) }
+
+ it "sets the module type to :svn" do
+ expect(subject.properties).to include(:type => :svn)
end
+
+ it "sets the expected version" do
+ expect(subject.properties).to include(:expected => 123)
+ end
+
+ it "sets the actual version to the revision when the revision is available" do
+ expect(subject.working_dir).to receive(:revision).and_return(12)
+ expect(subject.properties).to include(:actual => 12)
+ end
+
+ it "sets the actual version (unresolvable) when the revision is unavailable" do
+ expect(subject.working_dir).to receive(:revision).and_raise(ArgumentError)
+ expect(subject.properties).to include(:actual => "(unresolvable)")
+ end
end
describe "determining the status" do
subject { described_class.new('foo', '/moduledir', :svn => 'https://github.com/adrienthebo/r10k-fixture-repo', :rev => 123) }
@@ -112,10 +148,10 @@
subject.sync
end
it "removes the existing directory" do
- expect(subject.full_path).to receive(:rmtree)
+ expect(subject.path).to receive(:rmtree)
allow(subject).to receive(:install)
subject.sync
end
end