Changeset 1328

Show
Ignore:
Timestamp:
01/28/08 11:52:57 (9 months ago)
Author:
jimfree..@gmail.com
Message:

Generalized specs so they will pass regardless of hash ordering.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/spec/merb/render_spec.rb

    r1325 r1328  
    418418    c = new_spec_controller(:format => 'json', :controller => 'RenderHashObjectController') 
    419419    c.dispatch(:render_object) 
    420     c.body.should == "{\"baz\": \"quuz\", \"foo\": \"bar\"}" 
     420    JSON.load(c.body).should == {'baz' => "quuz", "foo" => "bar"} 
    421421  end 
    422422   
     
    424424    c = new_spec_controller(:format => 'xml', :controller => 'RenderHashObjectController') 
    425425    c.dispatch(:render_object) 
    426     c.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hash>\n  <baz>quuz</baz>\n  <foo>bar</foo>\n</hash>\n" 
     426    c.body.should match(/<\?xml version="1.0" encoding="UTF-8"\?>\n<hash>/m) 
     427    c.body.should match(/(<baz>quuz<\/baz>\n\s+<foo>bar<\/foo>\n<\/hash>)|(<foo>bar<\/foo>\n\s+<baz>quuz<\/baz>\n<\/hash>)/m) 
    427428  end 
    428429