summaryrefslogtreecommitdiff
path: root/spec/unit/provider/git_spec.rb
diff options
context:
space:
mode:
authorPawel Kozlowski <pawel.kozlowski@u2i.com>2012-11-05 20:08:14 +0100
committerBryan McLellan <btm@opscode.com>2013-06-18 11:09:12 -0700
commitb5e95c654f312a5e07ae29e063316b0ad5535bbf (patch)
tree32a66f9bca905b90b295cc90d6cffae56674a086 /spec/unit/provider/git_spec.rb
parent1c45026031490eea4a235af0fd5f0fabd8e1c57f (diff)
downloadchef-b5e95c654f312a5e07ae29e063316b0ad5535bbf.tar.gz
[CHEF-955] Turned on remote tracking branch setup for 'origin' remote in git provider
Diffstat (limited to 'spec/unit/provider/git_spec.rb')
-rw-r--r--spec/unit/provider/git_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index 80deb23fd5..066f4fd2ee 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -224,6 +224,9 @@ SHAS
end
it "runs a sync command with default options" do
+ conf_tracking_branches = "git config remote.origin.url git://github.com/opscode/chef.git && " +
+ "git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*"
+ @provider.should_receive(:shell_out!).with(conf_tracking_branches, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]", :log_level => :debug)
expected_cmd = "git fetch origin && git fetch origin --tags && git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd=> "/my/deploy/dir", :log_tag => "git[web2.0 app]")
@provider.fetch_updates
@@ -232,12 +235,27 @@ SHAS
it "runs a sync command with the user and group specified in the resource" do
@resource.user("whois")
@resource.group("thisis")
+ conf_tracking_branches = "git config remote.origin.url git://github.com/opscode/chef.git && " +
+ "git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*"
+ @provider.should_receive(:shell_out!).with(conf_tracking_branches, :cwd => "/my/deploy/dir",
+ :user => "whois", :group => "thisis", :log_tag => "git[web2.0 app]", :log_level => :debug)
expected_cmd = "git fetch origin && git fetch origin --tags && git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir",
:user => "whois", :group => "thisis", :log_tag => "git[web2.0 app]")
@provider.fetch_updates
end
+ it "configures remote tracking branches when remote is ``origin''" do
+ @resource.remote "origin"
+ conf_tracking_branches = "git config remote.origin.url git://github.com/opscode/chef.git && " +
+ "git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*"
+ @provider.should_receive(:shell_out!).with(conf_tracking_branches, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]", :log_level => :debug)
+ fetch_command = "git fetch origin && git fetch origin --tags && git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
+ @provider.should_receive(:shell_out!).with(fetch_command, :cwd => "/my/deploy/dir", :log_level => :debug, :log_tag => "git[web2.0 app]")
+ @provider.fetch_updates
+ @provider.converge
+ end
+
it "configures remote tracking branches when remote is not ``origin''" do
@resource.remote "opscode"
conf_tracking_branches = "git config remote.opscode.url git://github.com/opscode/chef.git && " +