aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-26 18:25:56 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-26 18:25:56 -0800
commit4bdc783d37b82b739c5ddcc828d3a253873f6629 (patch)
tree3032363590294e1fe650c533992dc15ea9af8efa
parentfaf3c2f827e786bc06ea143b80bb98c9a1e18304 (diff)
downloadrails-4bdc783d37b82b739c5ddcc828d3a253873f6629.tar.gz
rails-4bdc783d37b82b739c5ddcc828d3a253873f6629.tar.bz2
rails-4bdc783d37b82b739c5ddcc828d3a253873f6629.zip
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.
-rw-r--r--actionpack/test/controller/routing_test.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 31f86d2dde..fc85b01394 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -52,11 +52,17 @@ class UriReservedCharactersRoutingTest < Test::Unit::TestCase
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 @@ class LegacyRouteSetTests < Test::Unit::TestCase
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 @@ class RouteSetTest < ActiveSupport::TestCase
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