diff options
| author | ytti <saku@ytti.fi> | 2016-07-28 10:34:03 +0300 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-28 10:34:03 +0300 | 
| commit | 7d0dba17675a9c432189ec50584f5f449801f7d7 (patch) | |
| tree | 5004f4b3aec877c12903999242c400b2e198df84 /spec | |
| parent | c6246680d2cb524cba36d414411f6546224130e3 (diff) | |
| parent | b8f56e81dcc7696bb983cfc89a4829d28d4d638b (diff) | |
Merge pull request #513 from danilopopeye/512-fix-resolve_repo-crash
only resolve the repository path when the output is `git`
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/githubrepo_spec.rb | 15 | ||||
| -rw-r--r-- | spec/node_spec.rb | 1 | 
2 files changed, 9 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/node_spec.rb b/spec/node_spec.rb index 5cb5216..829e05a 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -46,6 +46,7 @@ describe Oxidized::Node do    describe '#repo' do      before do +      Oxidized.config.output.default = 'git'        Oxidized::Node.any_instance.unstub(:resolve_repo)      end | 
