diff options
author | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-03-06 17:06:26 +0100 |
---|---|---|
committer | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-03-06 18:24:02 +0100 |
commit | 6915fa7e3799ff56233cf7e2c4d24686e435c401 (patch) | |
tree | 00e46d6eff22c04ef0954e67fccbbc89637ef80c /spec/unit/puppet/provider/vcsrepo | |
parent | 04851c28b12973c679fc9f234fd0f5a193df9d7a (diff) | |
download | puppet-vcsrepo-6915fa7e3799ff56233cf7e2c4d24686e435c401.tar.gz puppet-vcsrepo-6915fa7e3799ff56233cf7e2c4d24686e435c401.tar.bz2 |
Update origin if necessary before checking revision
Diffstat (limited to 'spec/unit/puppet/provider/vcsrepo')
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/git_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index 83dbff2..4e4d9f3 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -127,6 +127,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do context "when its SHA is not different than the current SHA" do it "should return the ref" do + provider.expects(:git).with('config', 'remote.origin.url').returns('') provider.expects(:git).with('fetch', 'origin') # FIXME provider.expects(:git).with('fetch', '--tags', 'origin') provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha') @@ -137,6 +138,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do context "when its SHA is different than the current SHA" do it "should return the current SHA" do + provider.expects(:git).with('config', 'remote.origin.url').returns('') provider.expects(:git).with('fetch', 'origin') # FIXME provider.expects(:git).with('fetch', '--tags', 'origin') provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('othersha') @@ -144,6 +146,20 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do provider.revision.should == 'currentsha' end end + + context "when the source is modified" do + resource_with :source => 'git://git@foo.com/bar.git' do + it "should update the origin url" do + provider.expects(:git).with('config', 'remote.origin.url').returns('old') + provider.expects(:git).with('config', 'remote.origin.url', 'git://git@foo.com/bar.git') + provider.expects(:git).with('fetch', 'origin') # FIXME + provider.expects(:git).with('fetch', '--tags', 'origin') + provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha') + provider.expects(:git).with('tag', '-l').returns("Hello") + provider.revision.should == resource.value(:revision) + end + end + end end end @@ -189,6 +205,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do context "updating references" do it "should use 'git fetch --tags'" do expects_chdir + provider.expects(:git).with('config', 'remote.origin.url').returns('') provider.expects(:git).with('fetch', 'origin') provider.expects(:git).with('fetch', '--tags', 'origin') provider.update_references |