From a18ac7813c7f49be9611680f80a00b1b54f625ba Mon Sep 17 00:00:00 2001 From: Max Martin Date: Tue, 19 Apr 2011 14:11:01 -0700 Subject: maint: Fix PSON order dependency in test 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 --- spec/unit/node/facts_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spec/unit/node') diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 1b6991ca0..07f5f7e1b 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 -- cgit