1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Fixed hash spec for Ruby < 1.9 where order of hash keys is not guaranteed

This commit is contained in:
Mike Dvorkin 2011-01-27 19:14:03 -08:00
parent 0132bccb83
commit b2ce17dae6

View file

@ -270,7 +270,15 @@ EOS
end
it "plain multiline" do
@hash.ai(:plain => true).should == <<-EOS.strip
out = @hash.ai(:plain => true)
if RUBY_VERSION.to_f < 1.9 # Order of @hash keys is not guaranteed.
out.should =~ /^\{[^\}]+\}/m
out.should =~ / "b" => "b",?/
out.should =~ / :a => "a",?/
out.should =~ / :z => "z",?/
out.should =~ / "alpha" => "alpha",?$/
else
out.should == <<-EOS.strip
{
"b" => "b",
:a => "a",
@ -279,6 +287,7 @@ EOS
}
EOS
end
end
it "plain multiline with sorted keys" do
@hash.ai(:plain => true, :sorted_hash_keys => true).should == <<-EOS.strip