From d27759141ec5592fd5d76861efa77a55d07c90a8 Mon Sep 17 00:00:00 2001
From: Colleen Murphy <colleen@puppetlabs.com>
Date: Wed, 25 Mar 2015 12:04:16 -0700
Subject: Fix remote hash ordering for unit tests

Without this commit, the unit tests for the git provider changing
multiple remotes mocks the remotes in a particular order. While in
practice it doesn't matter which remote the update_remotes method
updates first, the unit tests must be able to mock them in the correct
order. For ruby 1.8.7, a Hash will not necessarily produce key value
pairs in the same order on each run, which causes intermittent failures
in the unit tests. This change sorts the :source property values before
trying to update them, and updates the unit tests to expect the values
in alphabetical order.
---
 spec/unit/puppet/provider/vcsrepo/git_spec.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'spec/unit/puppet')

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')
-- 
cgit v1.2.3