diff options
author | Markus Roberts <Markus@reality.com> | 2011-02-01 17:54:24 -0800 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2011-02-01 17:54:24 -0800 |
commit | f9e2e2b7d76ec88d7ad2ed0ce663b4219b72bc96 (patch) | |
tree | 7d45623846b449104429c49c675bf00a45610520 | |
parent | 392504a1eb49820711fe605e795fff897b5f5fcf (diff) | |
download | puppet-f9e2e2b7d76ec88d7ad2ed0ce663b4219b72bc96.tar.gz puppet-f9e2e2b7d76ec88d7ad2ed0ce663b4219b72bc96.tar.xz puppet-f9e2e2b7d76ec88d7ad2ed0ce663b4219b72bc96.zip |
Augmentation of tests for prior commit
There is no good answer to tests that depend on the order of itteration over hashes.
-rwxr-xr-x | spec/unit/util/zaml_spec.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/unit/util/zaml_spec.rb b/spec/unit/util/zaml_spec.rb index 782ebdb0b..fd506ea93 100755 --- a/spec/unit/util/zaml_spec.rb +++ b/spec/unit/util/zaml_spec.rb @@ -36,6 +36,10 @@ describe "Pure ruby yaml implementation" do end } + def set_of_lines(l) + l.split("\n").sort + end + it "should handle references to Array in Hash values correctly" do list = [1] data = { "one" => list, "two" => list } @@ -46,13 +50,15 @@ describe "Pure ruby yaml implementation" do it "should handle references to Hash in Hash values correctly" do hash = { 1 => 1 } data = { "one" => hash, "two" => hash } - data.to_yaml.should == "--- \n two: &id001 \n 1: 1\n one: *id001" + # This could still someday fail because the order change would also change which one got the back ref + set_of_lines(data.to_yaml).should == set_of_lines("--- \n two: &id001 \n 1: 1\n one: *id001") expect { YAML.load(data.to_yaml).should == data }.should_not raise_error end it "should handle references to Scalar in Hash" do str = "hello" data = { "one" => str, "two" => str } + set_of_lines(data.to_yaml).should == set_of_lines("--- \n two: hello\n one: hello") expect { YAML.load(data.to_yaml).should == data }.should_not raise_error end |