diff options
author | Tim Smith <tsmith@chef.io> | 2020-04-23 19:14:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-23 19:14:35 -0700 |
commit | 8dcbe94fbb51be2e21538b65ba776452a90c12ab (patch) | |
tree | 593178af63d2ea32325b4a4301d920fe87633238 /spec/unit/provider/git_spec.rb | |
parent | 6a7773c74624757d8f1f62761569def9824c2ff5 (diff) | |
parent | 676e29ae623fd529a0cc77ce832c7d73374f21a6 (diff) | |
download | chef-8dcbe94fbb51be2e21538b65ba776452a90c12ab.tar.gz |
Merge pull request #9726 from chef/lcg/chef-16-git
Refactor scm, git and subversion resources & fix longstanding git issues
Diffstat (limited to 'spec/unit/provider/git_spec.rb')
-rw-r--r-- | spec/unit/provider/git_spec.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index b98745b3ca..2f253358f1 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -400,7 +400,8 @@ describe Chef::Provider::Git do @provider.clone end - it "runs a checkout command with default options" do + it "runs a checkout command when the local branch is set" do + @resource.checkout_branch "deploy" expect(@provider).to receive(:shell_out!).with("git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c", cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]").ordered expect(@provider).to receive(:shell_out!).with("git checkout deploy", cwd: "/my/deploy/dir", @@ -607,7 +608,7 @@ describe Chef::Provider::Git do it "does not raise an error if user exists" do allow(@provider).to receive(:get_homedir).with(@resource.user).and_return("/home/test") - expect { @provider.run_action(:sync) }.not_to raise_error(ArgumentError) + expect { @provider.run_action(:sync) }.not_to raise_error end end @@ -622,8 +623,10 @@ describe Chef::Provider::Git do end it "does not raise an error if user exists" do + allow(@provider).to receive(:action_sync) # stub the entire action + allow(::File).to receive(:directory?).with("/my/deploy").and_return(true) allow(@provider).to receive(:get_homedir).with(@resource.user).and_return("/home/test") - expect { @provider.run_action(:sync) }.not_to raise_error(Chef::Exceptions::User) + expect { @provider.run_action(:sync) }.not_to raise_error end end |