提交 4bdc783d 编写于 作者: C Carlhuda

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

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.
上级 faf3c2f8
...@@ -52,11 +52,17 @@ def test_route_generation_allows_passing_non_string_values_to_generated_helper ...@@ -52,11 +52,17 @@ def test_route_generation_allows_passing_non_string_values_to_generated_helper
end end
class MockController class MockController
def url_for(options) def self.build(helpers)
options[:protocol] ||= "http" Class.new do
options[:host] ||= "test.host" def url_for(options)
options[:protocol] ||= "http"
options[:host] ||= "test.host"
super(options) super(options)
end
include helpers
end
end end
end end
...@@ -250,9 +256,7 @@ def test_optimised_named_route_with_host ...@@ -250,9 +256,7 @@ def test_optimised_named_route_with_host
end end
def setup_for_named_route def setup_for_named_route
inst = MockController.clone.new MockController.build(rs.url_helpers).new
inst.class.send(:include, rs.url_helpers)
inst
end end
def test_named_route_without_hash def test_named_route_without_hash
...@@ -741,7 +745,7 @@ def setup_named_route_test ...@@ -741,7 +745,7 @@ def setup_named_route_test
map.users '/admin/users', :controller => 'admin/users', :action => 'index' map.users '/admin/users', :controller => 'admin/users', :action => 'index'
end end
MockController.clone.new.tap { |inst| inst.class.send(:include, set.url_helpers)} MockController.build(set.url_helpers).new
end end
def test_named_route_hash_access_method def test_named_route_hash_access_method
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册