summaryrefslogtreecommitdiff
path: root/spec/node_spec.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-02-23 00:31:55 +0200
committerytti <saku@ytti.fi>2016-02-23 00:31:55 +0200
commit1d6be9c011a9195626f59d3d62ac2febe9dd3149 (patch)
tree01eb7f3d336aaeb90347510afb32715bd7c042bc /spec/node_spec.rb
parent2543d95d150844eb6e619f6c99dd26fc9b1d1084 (diff)
parent69210c7ddf7d77cc9eb7b78f0bc00ad2f1475955 (diff)
Merge pull request #326 from danilopopeye/group-remotes-and-hooks
multiple remotes for groups in GithubRepo hook
Diffstat (limited to 'spec/node_spec.rb')
-rw-r--r--spec/node_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/node_spec.rb b/spec/node_spec.rb
index c568463..21c6e34 100644
--- a/spec/node_spec.rb
+++ b/spec/node_spec.rb
@@ -41,4 +41,50 @@ describe Oxidized::Node do
status.must_equal :success
end
end
+
+ describe '#repo' do
+ let(:group) { nil }
+ let(:node) do
+ Oxidized::Node.new({
+ ip: '127.0.0.1', group: group, model: 'junos'
+ })
+ end
+
+ it 'when there are no groups' do
+ Oxidized.config.output.git.repo = '/tmp/repository.git'
+ node.repo.must_equal '/tmp/repository.git'
+ end
+
+ describe 'when there are groups' do
+ let(:group) { 'ggrroouupp' }
+
+ before do
+ Oxidized.config.output.git.single_repo = single_repo
+ end
+
+ describe 'with only one repository' do
+ let(:single_repo) { true }
+
+ before do
+ Oxidized.config.output.git.repo = '/tmp/repository.git'
+ end
+
+ it 'should use the correct remote' do
+ node.repo.must_equal '/tmp/repository.git'
+ end
+ end
+
+ describe 'with more than one repository' do
+ let(:single_repo) { nil }
+
+ before do
+ Oxidized.config.output.git.repo.ggrroouupp = '/tmp/ggrroouupp.git'
+ end
+
+ it 'should use the correct remote' do
+ node.repo.must_equal '/tmp/ggrroouupp.git'
+ end
+ end
+ end
+ end
end