From 695883a75783e19de70e60314fab49661c387a22 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Thu, 18 Feb 2016 17:01:25 -0200 Subject: create tests for `GithubRepo#validate_cfg!` method --- spec/githubrepo_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'spec/githubrepo_spec.rb') 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' -- cgit v1.2.1