diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2015-03-26 13:33:25 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2015-03-26 13:33:25 -0700 |
commit | 01bf2a6ba11f67635569d5ab7a35f37768cbd3af (patch) | |
tree | f2ab9d3e3439a676911a0ede12b7b5d515bb611d | |
parent | 9a955b8746f373a1a3e47ebf67d4186b98e0094f (diff) | |
parent | d27759141ec5592fd5d76861efa77a55d07c90a8 (diff) |
Merge pull request #240 from cmurphy/hash_ordering
Fix remote hash ordering for unit tests
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 3 | ||||
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/git_spec.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 9d3f7f3..000032e 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -142,7 +142,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) # we loop around the hash. Otherwise, we assume single url specified # in source property if @resource.value(:source).is_a?(Hash) - @resource.value(:source).each do |remote_name, remote_url| + @resource.value(:source).keys.sort.each do |remote_name| + remote_url = @resource.value(:source)[remote_name] at_path { do_update |= update_remote_url(remote_name, remote_url) } end else diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index d0153a1..d33c98a 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -263,7 +263,7 @@ branches context "when multiple sources are modified" do it "should update the urls" do resource[:source] = {"origin" => "git://git@foo.com/bar.git", "new_remote" => "git://git@foo.com/baz.git"} - provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/foo.git\n", "remote.origin.url=git://git@foo.com/bar.git\n") + provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/bar.git\n", "remote.origin.url=git://git@foo.com/foo.git\n") provider.expects(:git).with('remote', 'set-url', 'origin', 'git://git@foo.com/bar.git') provider.expects(:git).with('remote', 'add', 'new_remote', 'git://git@foo.com/baz.git') provider.expects(:git).with('remote','update') |