summaryrefslogtreecommitdiff
blob: 6f81ebcfe040d571b309dd3d5a674538d2709623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
commit c0e076b72e20442cb528010e9436f04a79de1a9b
Author: Ryan Tomayko <rtomayko@gmail.com>
Date:   Thu Sep 15 00:37:58 2011 -0700

    fix yajl template test failures due to hash (un)order under 1.8

diff --git a/test/tilt_yajltemplate_test.rb b/test/tilt_yajltemplate_test.rb
index 5226c16..707f97b 100644
--- a/test/tilt_yajltemplate_test.rb
+++ b/test/tilt_yajltemplate_test.rb
@@ -11,12 +11,20 @@ begin
 
     test "compiles and evaluates the template on #render" do
       template = Tilt::YajlTemplate.new { "json = { :integer => 3, :string => 'hello' }" }
-      assert_equal '{"integer":3,"string":"hello"}', template.render
+      output = template.render
+      result = Yajl::Parser.parse(output)
+      expect = {"integer" => 3,"string" => "hello"}
+      assert_equal expect, result
     end
 
     test "can be rendered more than once" do
       template = Tilt::YajlTemplate.new { "json = { :integer => 3, :string => 'hello' }" }
-      3.times { assert_equal '{"integer":3,"string":"hello"}', template.render }
+      expect = {"integer" => 3,"string" => "hello"}
+      3.times do
+        output = template.render
+        result = Yajl::Parser.parse(output)
+        assert_equal expect, result
+      end
     end
 
     test "evaluating ruby code" do