Testing of the to_pson method relied on order dependency that was
causing failures in ruby 1.8.6 (though not 1.8.7). Fixed this by parsing
the resulting PSON and testing the parsed object's properties instead of
doing string matching.

Reviewed-by:Matt Robinson <[email protected]>
Signed-off-by: Max Martin <[email protected]>
---
Local-branch: ticket/next/pson-ordering
 spec/unit/node/facts_spec.rb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb
index 1b6991c..07f5f7e 100755
--- a/spec/unit/node/facts_spec.rb
+++ b/spec/unit/node/facts_spec.rb
@@ -126,7 +126,12 @@ describe Puppet::Node::Facts, "when indirecting" do
         Time.stubs(:now).returns(@timestamp)
         facts = Puppet::Node::Facts.new("foo", {'a' => 1, 'b' => 2, 'c' => 3})
         facts.expiration = @expiration
-        facts.to_pson.should == 
%Q[{"data":{"name":"foo","timestamp":"#{@timestamp}","expiration":"#{@expiration}","values":{"a":1,"b":2,"c":3}},"document_type":"Puppet::Node::Facts"}]
+        result = PSON.parse(facts.to_pson)
+        result.name.should == facts.name
+        result.values.should == facts.values
+        result.timestamp.should == facts.timestamp
+        result.expiration.should == facts.expiration
+        result.type.should == Puppet::Node::Facts
       end
 
       it "should not include nil values" do
-- 
1.7.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to