Permalink
Browse files

Ruby 1.9: resolve constant lookup issues

  • Loading branch information...
1 parent 0ff8f81 commit 425a02cecea188f502ad8f137271d1b90b9c7558 @jeremy jeremy committed Nov 4, 2009
@@ -3,12 +3,6 @@
ActionController::Base.helpers_dir = File.dirname(__FILE__) + '/../fixtures/helpers'
-class TestController < ActionController::Base
- attr_accessor :delegate_attr
- def delegate_method() end
- def rescue_action(e) raise end
-end
-
module Fun
class GamesController < ActionController::Base
def render_hello_world
@@ -38,6 +32,12 @@ def c() end
end
class HelperTest < Test::Unit::TestCase
+ class TestController < ActionController::Base
+ attr_accessor :delegate_attr
+ def delegate_method() end
+ def rescue_action(e) raise end
+ end
+
def setup
# Increment symbol counter.
@symbol = (@@counter ||= 'A0').succ!.dup
@@ -860,7 +860,7 @@ def test_access_to_action_name_in_view
# :ported:
def test_access_to_controller_name_in_view
get :accessing_controller_name_in_template
- assert_equal "test", @response.body # name is explicitly set to 'test' inside the controller.
+ assert_equal "test", @response.body # name is explicitly set in the controller.
end
# :ported:
@@ -343,9 +343,9 @@ def show_errors(exception)
def with_test_routing
with_routing do |set|
set.draw do |map|
- match 'foo', :to => TestController.action(:foo)
- match 'invalid', :to => TestController.action(:invalid)
- match 'b00m', :to => TestController.action(:b00m)
+ match 'foo', :to => ::RescueTest::TestController.action(:foo)
+ match 'invalid', :to => ::RescueTest::TestController.action(:invalid)
+ match 'b00m', :to => ::RescueTest::TestController.action(:b00m)
end
yield
end
@@ -126,7 +126,7 @@ def test_no_deprecation_warning_for_named_route
with_routing do |set|
set.draw do |map|
match 'foo', :to => 'test#foo', :as => :foo
- match 'verification_test/:action', :to => TestController
+ match 'verification_test/:action', :to => ::VerificationTest::TestController
end
get :guarded_one_for_named_route_test, :two => "not one"
assert_redirected_to '/foo'
@@ -57,7 +57,7 @@ def assert_parses(expected, actual, headers = {})
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::JsonParamsParsingTest::TestController
end
yield
end
@@ -109,12 +109,12 @@ def teardown
def assert_parses(expected, actual)
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::QueryStringParsingTest::TestController
end
get "/parse", actual
assert_response :ok
- assert_equal(expected, TestController.last_query_parameters)
+ assert_equal(expected, ::QueryStringParsingTest::TestController.last_query_parameters)
end
end
end
@@ -130,7 +130,7 @@ def teardown
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::UrlEncodedParamsParsingTest::TestController
end
yield
end
@@ -84,7 +84,7 @@ def teardown
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::XmlParamsParsingTest::TestController
end
yield
end
@@ -100,4 +100,4 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest
def default_headers
{'HTTP_X_POST_DATA_FORMAT' => 'xml'}
end
-end
+end
@@ -219,7 +219,7 @@ def test_session_store_with_expire_after
def with_test_route_set(options = {})
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::CookieStoreTest::TestController
end
options = {:key => SessionKey, :secret => SessionSecret}.merge(options)
@app = ActionDispatch::Session::CookieStore.new(set, options)
@@ -112,7 +112,7 @@ def test_prevents_session_fixation
def with_test_route_set
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::MemCacheStoreTest::TestController
end
@app = ActionDispatch::Session::MemCacheStore.new(set, :key => '_session_id')
yield

0 comments on commit 425a02c

Please sign in to comment.