Permalink
Browse files

1.9 seems to have a bug involving cloned classes and super. Fix it by…

… not cloning (and instead creating classes on demand). The 1.9 bug should be investigated.
  • Loading branch information...
1 parent faf3c2f commit 4bdc783d37b82b739c5ddcc828d3a253873f6629 Carlhuda committed Feb 27, 2010
Showing with 12 additions and 8 deletions.
  1. +12 −8 actionpack/test/controller/routing_test.rb
@@ -52,11 +52,17 @@ def test_route_generation_allows_passing_non_string_values_to_generated_helper
end
class MockController
- def url_for(options)
- options[:protocol] ||= "http"
- options[:host] ||= "test.host"
+ def self.build(helpers)
+ Class.new do
+ def url_for(options)
+ options[:protocol] ||= "http"
+ options[:host] ||= "test.host"
- super(options)
+ super(options)
+ end
+
+ include helpers
+ end
end
end
@@ -250,9 +256,7 @@ def test_optimised_named_route_with_host
end
def setup_for_named_route
- inst = MockController.clone.new
- inst.class.send(:include, rs.url_helpers)
- inst
+ MockController.build(rs.url_helpers).new
end
def test_named_route_without_hash
@@ -741,7 +745,7 @@ def setup_named_route_test
map.users '/admin/users', :controller => 'admin/users', :action => 'index'
end
- MockController.clone.new.tap { |inst| inst.class.send(:include, set.url_helpers)}
+ MockController.build(set.url_helpers).new
end
def test_named_route_hash_access_method

1 comment on commit 4bdc783

Contributor

aaronchi commented on 4bdc783 Feb 27, 2010

routes still appear to be broken in 1.9

Please sign in to comment.