diff options
author | James Bence <jbence@mdsol.com> | 2014-09-23 11:24:41 -0700 |
---|---|---|
committer | James Bence <jbence@mdsol.com> | 2014-09-23 11:24:41 -0700 |
commit | e9f23a3dfbb7c9d6ca742af2438c888572b0c3b1 (patch) | |
tree | a8a768a50a3aafc158836a0178c2fd466ffcd240 /spec/unit/provider | |
parent | 27c1ea2bdcf059f9750b004dee323f9d8b5310a2 (diff) | |
download | chef-e9f23a3dfbb7c9d6ca742af2438c888572b0c3b1.tar.gz |
Update specs for exact match on remote revisions
Diffstat (limited to 'spec/unit/provider')
-rw-r--r-- | spec/unit/provider/git_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index 143c22da6e..809b68c727 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -106,6 +106,33 @@ describe Chef::Provider::Git do @provider.target_revision.should eql("663c22a5e41f5ae3193460cca044ed1435029f53") end + it "converts resource.revision from a tag to a SHA using an exact match" do + @resource.revision "v1.0" + @stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" + + "663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/releases/v1.0\n" + + "503c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n") + @provider.should_receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", {:log_tag=>"git[web2.0 app]"}).and_return(double("ShellOut result", :stdout => @stdout)) + @provider.target_revision.should eql("503c22a5e41f5ae3193460cca044ed1435029f53") + end + + it "converts resource.revision from a tag to a SHA, matching tags first, then heads" do + @resource.revision "v1.0" + @stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" + + "663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n" + + "503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n") + @provider.should_receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", {:log_tag=>"git[web2.0 app]"}).and_return(double("ShellOut result", :stdout => @stdout)) + @provider.target_revision.should eql("663c22a5e41f5ae3193460cca044ed1435029f53") + end + + it "converts resource.revision from a tag to a SHA, using full path if provided" do + @resource.revision "refs/heads/v1.0" + @stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" + + "663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n" + + "503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n") + @provider.should_receive(:shell_out!).with(@git_ls_remote + "\"refs/heads/v1.0*\"", {:log_tag=>"git[web2.0 app]"}).and_return(double("ShellOut result", :stdout => @stdout)) + @provider.target_revision.should eql("503c22a5e41f5ae3193460cca044ed1435029f53") + end + it "raises an invalid remote reference error if you try to deploy from ``origin'' and assertions are run" do @resource.revision "origin/" @provider.action = :checkout |