summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/githubrepo_spec.rb9
-rw-r--r--spec/input/ssh_spec.rb2
-rw-r--r--spec/spec_helper.rb2
3 files changed, 7 insertions, 6 deletions
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