diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/githubrepo_spec.rb | 15 | ||||
| -rw-r--r-- | spec/input/ssh_spec.rb | 1 | ||||
| -rw-r--r-- | spec/node_spec.rb | 6 | ||||
| -rw-r--r-- | spec/nodes_spec.rb | 1 | 
4 files changed, 16 insertions, 7 deletions
| diff --git a/spec/githubrepo_spec.rb b/spec/githubrepo_spec.rb index ab5e251..2f84c78 100644 --- a/spec/githubrepo_spec.rb +++ b/spec/githubrepo_spec.rb @@ -10,10 +10,11 @@ describe GithubRepo do    let(:repo) { mock() }    let(:gr) { GithubRepo.new } -  before(:each) do +  before do      Oxidized.asetus = Asetus.new      Oxidized.config.log = '/dev/null'      Oxidized.setup_logger +    Oxidized.config.output.default = 'git'    end    describe '#validate_cfg!' do @@ -84,23 +85,23 @@ describe GithubRepo do      let(:group) { nil }      let(:ctx) { OpenStruct.new(node: node) }      let(:node) do -      Oxidized::Node.new(ip: '127.0.0.1', group: group, model: 'junos', output: 'output') +      Oxidized::Node.new(ip: '127.0.0.1', group: group, model: 'junos', output: 'git')      end      before do        repo_head.expects(:name).twice.returns('refs/heads/master')        repo.expects(:head).twice.returns(repo_head) -      repo.expects(:path).returns('foo.git') +      repo.expects(:path).returns('/foo.git')        repo.expects(:fetch).with('origin', ['refs/heads/master'], credentials: credentials).returns(Hash.new(0))      end      describe 'when there is only one repository and no groups' do        before do -        Oxidized.config.output.git.repo = 'foo.git' +        Oxidized.config.output.git.repo = '/foo.git'          remote.expects(:url).returns('https://github.com/username/foo.git')          remote.expects(:push).with(['refs/heads/master'], credentials: credentials).returns(true)          repo.expects(:remotes).returns({'origin' => remote}) -        Rugged::Repository.expects(:new).with('foo.git').returns(repo) +        Rugged::Repository.expects(:new).with('/foo.git').returns(repo)        end        it "will push to the remote repository using https" do @@ -136,7 +137,7 @@ describe GithubRepo do        describe 'and there are several repositories' do          let(:create_remote) { 'ggrroouupp#remote_repo' } -        let(:repository) { './ggrroouupp.git' } +        let(:repository) { '/ggrroouupp.git' }          before do            Oxidized.config.output.git.repo.ggrroouupp = repository @@ -151,7 +152,7 @@ describe GithubRepo do        describe 'and has a single repository' do          let(:create_remote) { 'github_repo_hook#remote_repo' } -        let(:repository) { 'foo.git' } +        let(:repository) { '/foo.git' }          before do            Oxidized.config.output.git.repo = repository diff --git a/spec/input/ssh_spec.rb b/spec/input/ssh_spec.rb index 2550d5c..d86ffa0 100644 --- a/spec/input/ssh_spec.rb +++ b/spec/input/ssh_spec.rb @@ -5,6 +5,7 @@ describe Oxidized::SSH do    before(:each) do      Oxidized.asetus = Asetus.new      Oxidized.setup_logger +    Oxidized::Node.any_instance.stubs(:resolve_repo)      Oxidized::Node.any_instance.stubs(:resolve_input)      Oxidized::Node.any_instance.stubs(:resolve_output)      @node = Oxidized::Node.new(name: 'example.com', diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 1c38558..829e05a 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -5,6 +5,7 @@ describe Oxidized::Node do      Oxidized.asetus = Asetus.new      Oxidized.setup_logger +    Oxidized::Node.any_instance.stubs(:resolve_repo)      Oxidized::Node.any_instance.stubs(:resolve_output)      @node = Oxidized::Node.new(name: 'example.com',                                 input: 'ssh', @@ -44,6 +45,11 @@ describe Oxidized::Node do    end    describe '#repo' do +    before do +      Oxidized.config.output.default = 'git' +      Oxidized::Node.any_instance.unstub(:resolve_repo) +    end +      let(:group) { nil }      let(:node) do        Oxidized::Node.new({ diff --git a/spec/nodes_spec.rb b/spec/nodes_spec.rb index 4560bdb..6fa4b41 100644 --- a/spec/nodes_spec.rb +++ b/spec/nodes_spec.rb @@ -15,6 +15,7 @@ describe Oxidized::Nodes do        prompt: 'test_prompt'      } +    Oxidized::Node.any_instance.stubs(:resolve_repo)      Oxidized::Node.any_instance.stubs(:resolve_output)      @nodes_org = %w(ltt-pe1.hel kes2-rr1.tku tor-peer1.oul                      hal-p2.tre sav-gr1-sw1.kuo psl-sec-pe1.hel).map { |e| Oxidized::Node.new(opts.merge(name: e)) } | 
