Skip to content
This repository
Browse code

Fix AV::FixtureResolver and rjs tests with random order errors

Due to the hash ordering changes on Ruby 1.8.7-p358.
  • Loading branch information...
commit 9698312704017d634cebe48e9ca06042b3d549c5 1 parent 00726ea
Carlos Antonio da Silva authored March 24, 2012
9  actionpack/lib/action_view/testing/resolvers.rb
@@ -22,10 +22,11 @@ def query(path, exts, formats)
22 22
       end
23 23
 
24 24
       templates = []
25  
-      @hash.select { |k,v| k =~ /^#{query}$/ }.each do |path, source|
26  
-        handler, format = extract_handler_and_format(path, formats)
27  
-        templates << Template.new(source, path, handler,
28  
-          :virtual_path => path, :format => format)
  25
+      @hash.each do |_path, source|
  26
+        next unless _path =~ /^#{query}$/
  27
+        handler, format = extract_handler_and_format(_path, formats)
  28
+        templates << Template.new(source, _path, handler,
  29
+          :virtual_path => _path, :format => format)
29 30
       end
30 31
 
31 32
       templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size }
24  actionpack/test/controller/new_base/render_rjs_test.rb
@@ -4,18 +4,18 @@ module RenderRjs
4 4
   class BasicController < ActionController::Base
5 5
     layout "application", :only => :index_respond_to
6 6
 
7  
-    self.view_paths = [ActionView::FixtureResolver.new(
8  
-      "layouts/application.html.erb"           => "",
9  
-      "render_rjs/basic/index.js.rjs"          => "page[:customer].replace_html render(:partial => 'customer')",
10  
-      "render_rjs/basic/index_html.js.rjs"     => "page[:customer].replace_html :partial => 'customer'",
11  
-      "render_rjs/basic/index_no_js.js.erb"    => "<%= render(:partial => 'developer') %>",
12  
-      "render_rjs/basic/_customer.js.erb"      => "JS Partial",
13  
-      "render_rjs/basic/_customer.html.erb"    => "HTML Partial",
14  
-      "render_rjs/basic/_developer.html.erb"   => "HTML Partial",
15  
-      "render_rjs/basic/index_locale.js.rjs"   => "page[:customer].replace_html :partial => 'customer'",
16  
-      "render_rjs/basic/_customer.da.html.erb" => "Danish HTML Partial",
17  
-      "render_rjs/basic/_customer.da.js.erb"   => "Danish JS Partial"
18  
-    )]
  7
+    self.view_paths = [ActionView::FixtureResolver.new(ActiveSupport::OrderedHash[
  8
+      "layouts/application.html.erb"           , "",
  9
+      "render_rjs/basic/index.js.rjs"          , "page[:customer].replace_html render(:partial => 'customer')",
  10
+      "render_rjs/basic/index_html.js.rjs"     , "page[:customer].replace_html :partial => 'customer'",
  11
+      "render_rjs/basic/index_no_js.js.erb"    , "<%= render(:partial => 'developer') %>",
  12
+      "render_rjs/basic/_customer.js.erb"      , "JS Partial",
  13
+      "render_rjs/basic/_customer.html.erb"    , "HTML Partial",
  14
+      "render_rjs/basic/_developer.html.erb"   , "HTML Partial",
  15
+      "render_rjs/basic/index_locale.js.rjs"   , "page[:customer].replace_html :partial => 'customer'",
  16
+      "render_rjs/basic/_customer.da.html.erb" , "Danish HTML Partial",
  17
+      "render_rjs/basic/_customer.da.js.erb"   , "Danish JS Partial"
  18
+    ])]
19 19
 
20 20
     def index
21 21
       render

0 notes on commit 9698312

Please sign in to comment.
Something went wrong with that request. Please try again.