summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDanilo Sousa <dsgoncalves@uoldiveo.com>2016-02-18 17:01:25 -0200
committerDanilo Sousa <dsgoncalves@uoldiveo.com>2016-02-18 17:01:25 -0200
commit695883a75783e19de70e60314fab49661c387a22 (patch)
tree6d1a73e712d824d0e28df6667e9f15731505e952 /spec
parenta626c212f9e64434b828dadcb0cb3bd879beb612 (diff)
create tests for `GithubRepo#validate_cfg!` method
Diffstat (limited to 'spec')
-rw-r--r--spec/githubrepo_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/githubrepo_spec.rb b/spec/githubrepo_spec.rb
index 36207d3..4674035 100644
--- a/spec/githubrepo_spec.rb
+++ b/spec/githubrepo_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'rugged'
require 'oxidized/hook/githubrepo'
-describe Oxidized::GithubRepo do
+describe GithubRepo do
let(:credentials) { mock() }
let(:remote) { mock() }
let(:remotes) { mock() }
@@ -17,6 +17,18 @@ describe Oxidized::GithubRepo do
Oxidized.setup_logger
end
+ describe '#validate_cfg!' do
+ before do
+ gr.expects(:respond_to?).with(:validate_cfg!).returns(false) # `cfg=` call
+ end
+
+ it 'raise a error when `remote_repo` is not configured' do
+ Oxidized.config.hooks.github_repo_hook = { type: 'githubrepo' }
+ gr.cfg = Oxidized.config.hooks.github_repo_hook
+ proc { gr.validate_cfg! }.must_raise(KeyError)
+ end
+ end
+
describe "#fetch_and_merge_remote" do
before(:each) do
Oxidized.config.hooks.github_repo_hook.remote_repo = 'git@github.com:username/foo.git'