summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/node_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/node_spec.rb b/spec/node_spec.rb
index c568463..f9c912e 100644
--- a/spec/node_spec.rb
+++ b/spec/node_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
describe Oxidized::Node do
before(:each) do
Oxidized.stubs(:asetus).returns(Asetus.new)
+ Oxidized.config.output.git.repo = '/tmp/repository.git'
Oxidized::Node.any_instance.stubs(:resolve_output)
@node = Oxidized::Node.new(name: 'example.com',
@@ -41,4 +42,28 @@ describe Oxidized::Node do
status.must_equal :success
end
end
+
+ describe '#repo' do
+ it 'when there is no groups' do
+ @node.repo.must_equal '/tmp/repository.git'
+ end
+
+ describe 'when there are groups' do
+ let(:node) do
+ Oxidized::Node.new({
+ ip: '127.0.0.1', group: 'ggrroouupp', model: 'junos'
+ })
+ end
+
+ it 'with only one repository' do
+ Oxidized.config.output.git.single_repo = true
+ node.repo.must_equal '/tmp/repository.git'
+ end
+
+ it 'with more than one repository' do
+ Oxidized.config.output.git.single_repo = false
+ node.repo.must_equal '/tmp/ggrroouupp.git'
+ end
+ end
+ end
end