diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/cli_spec.rb | 10 | ||||
| -rw-r--r-- | spec/githubrepo_spec.rb | 9 | ||||
| -rw-r--r-- | spec/input/ssh_spec.rb | 2 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 2 | 
4 files changed, 15 insertions, 8 deletions
| diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index eb9872e..bf6058a 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -2,8 +2,14 @@ require 'spec_helper'  require 'oxidized/cli'  describe Oxidized::CLI do -  before { @original = ARGV } -  after  { ARGV.replace @original } +  before(:each) do  +    @original = ARGV  +    Oxidized.asetus = Asetus.new  +  end +   +  after(:each) do +    ARGV.replace @original +  end    %w[-v --version].each do |option|      describe option do diff --git a/spec/githubrepo_spec.rb b/spec/githubrepo_spec.rb index 2f84c78..e676534 100644 --- a/spec/githubrepo_spec.rb +++ b/spec/githubrepo_spec.rb @@ -32,7 +32,7 @@ describe GithubRepo do    describe "#fetch_and_merge_remote" do      before(:each) do        Oxidized.config.hooks.github_repo_hook.remote_repo = 'git@github.com:username/foo.git' -      Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) +      Proc.expects(:new).returns(credentials)        repo_head.expects(:name).returns('refs/heads/master')        gr.cfg = Oxidized.config.hooks.github_repo_hook      end @@ -89,6 +89,7 @@ describe GithubRepo do      end      before do +      Proc.expects(:new).returns(credentials)        repo_head.expects(:name).twice.returns('refs/heads/master')        repo.expects(:head).twice.returns(repo_head)        repo.expects(:path).returns('/foo.git') @@ -108,14 +109,14 @@ describe GithubRepo do          Oxidized.config.hooks.github_repo_hook.remote_repo = 'https://github.com/username/foo.git'          Oxidized.config.hooks.github_repo_hook.username = 'username'          Oxidized.config.hooks.github_repo_hook.password = 'password' -        Rugged::Credentials::UserPassword.expects(:new).with(username: 'username', password: 'password').returns(credentials) +        Proc.expects(:new).returns(credentials)          gr.cfg = Oxidized.config.hooks.github_repo_hook          gr.run_hook(ctx).must_equal true        end        it "will push to the remote repository using ssh" do          Oxidized.config.hooks.github_repo_hook.remote_repo = 'git@github.com:username/foo.git' -        Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) +        Proc.expects(:new).returns(credentials)          gr.cfg = Oxidized.config.hooks.github_repo_hook          gr.run_hook(ctx).must_equal true        end @@ -125,7 +126,7 @@ describe GithubRepo do        let(:group) { 'ggrroouupp' }        before do -        Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) +        Proc.expects(:new).returns(credentials)          Rugged::Repository.expects(:new).with(repository).returns(repo)          repo.expects(:remotes).twice.returns(remotes) diff --git a/spec/input/ssh_spec.rb b/spec/input/ssh_spec.rb index d86ffa0..7be9139 100644 --- a/spec/input/ssh_spec.rb +++ b/spec/input/ssh_spec.rb @@ -24,7 +24,7 @@ describe Oxidized::SSH do        model = mock()        model.expects(:cfg).returns({'ssh' => []}) -      @node.expects(:model).returns(model) +      @node.expects(:model).returns(model).at_least_once        proxy = mock()        Net::SSH::Proxy::Command.expects(:new).with("ssh test.com -W %h:%p").returns(proxy) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 28eb9d4..2b49a6c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@  require 'minitest/autorun' -require 'mocha/mini_test' +require 'mocha/minitest'  require 'oxidized'  Oxidized.mgr = Oxidized::Manager.new | 
