diff options
author | Pawel Kozlowski <pawel.kozlowski@u2i.com> | 2013-06-17 23:31:02 +0200 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-06-18 11:09:13 -0700 |
commit | 309635b8b05f620704627be421eef508a735f68b (patch) | |
tree | c0d960fda0dd409493c5dbaf46c059743ab9ff71 /spec | |
parent | a6b85925db688b174d7a5b9876aff42841226875 (diff) | |
download | chef-309635b8b05f620704627be421eef508a735f68b.tar.gz |
[CHEF-955] Refactored remote url update conditions
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/git_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index 608c04becd..763de240cc 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -486,4 +486,53 @@ SHAS @provider.add_remotes end end + + describe "calling multiple_remotes?" do + before(:each) do + @command_response = double('shell_out') + end + + describe "when check remote command returns with status 2" do + it "returns true" do + @command_response.stub(:exitstatus) { 2 } + @provider.multiple_remotes?(@command_response).should be_true + end + end + + describe "when check remote command returns with status 0" do + it "returns false" do + @command_response.stub(:exitstatus) { 0 } + @provider.multiple_remotes?(@command_response).should be_false + end + end + + describe "when check remote command returns with status 0" do + it "returns false" do + @command_response.stub(:exitstatus) { 1 } + @provider.multiple_remotes?(@command_response).should be_false + end + end + end + + describe "calling remote_matches?" do + before(:each) do + @command_response = double('shell_out') + end + + describe "when output of the check remote command matches the repository url" do + it "returns true" do + @command_response.stub(:exitstatus) { 0 } + @command_response.stub(:stdout) { @resource.repository } + @provider.remote_matches?(@resource.repository, @command_response).should be_true + end + end + + describe "when output of the check remote command doesn't match the repository url" do + it "returns false" do + @command_response.stub(:exitstatus) { 0 } + @command_response.stub(:stdout) { @resource.repository + "test" } + @provider.remote_matches?(@resource.repository, @command_response).should be_false + end + end + end end |