diff options
author | Jack Foy <jfoy@whitepages.com> | 2013-06-06 17:03:15 -0700 |
---|---|---|
committer | Jack Foy <jfoy@whitepages.com> | 2013-07-19 14:09:03 -0700 |
commit | beba8f473fee61747faa0b05d5d486a61f824761 (patch) | |
tree | 8b3935684d7ed67a66d9f43721f044b45dfe68f1 /spec/unit/provider/git_spec.rb | |
parent | 78ac800a11fbbcd67125a21c19b0d62465013748 (diff) | |
download | chef-beba8f473fee61747faa0b05d5d486a61f824761.tar.gz |
Update specs to encompass scm timeout attribute
Diffstat (limited to 'spec/unit/provider/git_spec.rb')
-rw-r--r-- | spec/unit/provider/git_spec.rb | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index 763de240cc..f364238d0f 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -18,7 +18,7 @@ require 'spec_helper' -describe Chef::Provider::Git do +describe Chef::Provider::Git, :focus => true do before(:each) do STDOUT.stub!(:tty?).and_return(true) @@ -165,15 +165,39 @@ SHAS @provider.should respond_to(:revision_slug) end - it "runs a clone command with default git options" do - @resource.user "deployNinja" - @resource.ssh_wrapper "do_it_this_way.sh" - expected_cmd = "git clone \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\"" - @provider.should_receive(:shell_out!).with(expected_cmd, :user => "deployNinja", - :environment =>{"GIT_SSH"=>"do_it_this_way.sh"}, - :log_tag => "git[web2.0 app]" ) - - @provider.clone + context "with an ssh wrapper" do + let(:deploy_user) { "deployNinja" } + let(:wrapper) { "do_it_this_way.sh" } + let(:expected_cmd) { 'git clone "git://github.com/opscode/chef.git" "/my/deploy/dir"' } + let(:default_options) do + { + :user => deploy_user, + :environment => { "GIT_SSH" => wrapper }, + :log_level => :info, + :log_tag => "git[web2.0 app]", + :live_stream => STDOUT, + } + end + before do + @resource.user deploy_user + @resource.ssh_wrapper wrapper + end + context "without a timeout set" do + it "clones a repo with default git options" do + @provider.should_receive(:shell_out!) + .with(expected_cmd, default_options) + @provider.clone + end + end + context "with a timeout set" do + let (:seconds) { 10 } + before { @resource.timeout(seconds) } + it "clones a repo with amended git options" do + @provider.should_receive(:shell_out!) + .with(expected_cmd, default_options.merge(:timeout => seconds)) + @provider.clone + end + end end it "runs a clone command with escaped destination" do |