diff options
| author | Max Martin <max@puppetlabs.com> | 2011-04-19 14:11:01 -0700 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-04-19 14:11:01 -0700 |
| commit | a18ac7813c7f49be9611680f80a00b1b54f625ba (patch) | |
| tree | 960e675f0d87be188fe320a12019637c647cfa35 /spec/unit/node | |
| parent | 485501a55e99b51cf8c9affa07a9f873a6cbc951 (diff) | |
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 <matt@puppetlabs.com>
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | 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 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 |
