summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-04-11 13:41:31 +0300
committerGitHub <noreply@github.com>2018-04-11 13:41:31 +0300
commitf81034d05f481b8f6e6ad9d939bd8a2a3d988d4b (patch)
tree2f75c69f0f0dbf82164d66ce328faf01c41aff73 /spec
parent7667bd285f9df6d6f2678f361e555a3bdb9e814c (diff)
parent56ba0d670100de87f94778f434d26e87fc741fa0 (diff)
Merge pull request #1269 from wk/githubrepo-test
Update githubrepo_spec.rb to pass successfully
Diffstat (limited to 'spec')
-rw-r--r--spec/githubrepo_spec.rb9
1 files changed, 5 insertions, 4 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)