aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-10-20 16:03:55 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-20 16:03:55 -0500
commita5c82a9dfb6d63bf90a3378da0b71d6ea592d7e3 (patch)
tree8dd54db8e9028021cfbff8b6aaed298b48b4d94a /actionpack/test/controller
parent207d0483e57b8d017ddd0c225d30a3e4fc9edc0c (diff)
downloadrails-a5c82a9dfb6d63bf90a3378da0b71d6ea592d7e3.tar.gz
rails-a5c82a9dfb6d63bf90a3378da0b71d6ea592d7e3.tar.bz2
rails-a5c82a9dfb6d63bf90a3378da0b71d6ea592d7e3.zip
Start rewriting some internal tests to use the new routing dsl
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/base_test.rb24
-rw-r--r--actionpack/test/controller/integration_test.rb2
-rw-r--r--actionpack/test/controller/rescue_test.rb6
-rw-r--r--actionpack/test/controller/url_rewriter_test.rb8
-rw-r--r--actionpack/test/controller/verification_test.rb4
5 files changed, 21 insertions, 23 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index b97ceb4594..b57550a69a 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -10,12 +10,12 @@ module Submodule
def public_action
render :nothing => true
end
-
+
hide_action :hidden_action
def hidden_action
raise "Noooo!"
end
-
+
def another_hidden_action
end
hide_action :another_hidden_action
@@ -30,25 +30,25 @@ class NonEmptyController < ActionController::Base
def public_action
render :nothing => true
end
-
+
hide_action :hidden_action
def hidden_action
end
end
class MethodMissingController < ActionController::Base
-
+
hide_action :shouldnt_be_called
def shouldnt_be_called
raise "NO WAY!"
end
-
+
protected
-
+
def method_missing(selector)
render :text => selector.to_s
end
-
+
end
class DefaultUrlOptionsController < ActionController::Base
@@ -79,7 +79,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
@empty = EmptyController.new
@contained = Submodule::ContainedEmptyController.new
@empty_controllers = [@empty, @contained, Submodule::SubclassedController.new]
-
+
@non_empty_controllers = [NonEmptyController.new,
Submodule::ContainedNonEmptyController.new]
end
@@ -135,24 +135,24 @@ class PerformActionTest < ActionController::TestCase
rescue_action_in_public!
end
-
+
def test_get_on_priv_should_show_selector
use_controller MethodMissingController
get :shouldnt_be_called
assert_response :success
assert_equal 'shouldnt_be_called', @response.body
end
-
+
def test_method_missing_is_not_an_action_name
use_controller MethodMissingController
assert ! @controller.__send__(:action_method?, 'method_missing')
-
+
get :method_missing
assert_response :success
assert_equal 'method_missing', @response.body
end
-
+
def test_get_on_hidden_should_fail
use_controller NonEmptyController
assert_raise(ActionController::UnknownAction) { get :hidden_action }
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index fe95fb5750..d6e2a5a974 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -390,7 +390,7 @@ class IntegrationProcessTest < ActionController::IntegrationTest
def with_test_route_set
with_routing do |set|
set.draw do |map|
- map.connect "/:action", :controller => "integration_process_test/integration"
+ match ':action', :to => IntegrationController
end
yield
end
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 054a9f2aaf..2b1f532b8d 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -343,9 +343,9 @@ class RescueTest < ActionController::IntegrationTest
def with_test_routing
with_routing do |set|
set.draw do |map|
- map.connect 'foo', :controller => "rescue_test/test", :action => 'foo'
- map.connect 'invalid', :controller => "rescue_test/test", :action => 'invalid'
- map.connect 'b00m', :controller => "rescue_test/test", :action => 'b00m'
+ match 'foo', :to => TestController.action(:foo)
+ match 'invalid', :to => TestController.action(:invalid)
+ match 'b00m', :to => TestController.action(:b00m)
end
yield
end
diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb
index d81ced96a8..3b14cbb2d8 100644
--- a/actionpack/test/controller/url_rewriter_test.rb
+++ b/actionpack/test/controller/url_rewriter_test.rb
@@ -224,9 +224,8 @@ class UrlWriterTests < ActionController::TestCase
def test_named_routes
with_routing do |set|
set.draw do |map|
- map.no_args '/this/is/verbose', :controller => 'home', :action => 'index'
- map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index'
- map.connect ':controller/:action/:id'
+ match 'this/is/verbose', :to => 'home#index', :as => :no_args
+ match 'home/sweet/home/:user', :to => 'home#index', :as => :home
end
# We need to create a new class in order to install the new named route.
@@ -264,7 +263,7 @@ class UrlWriterTests < ActionController::TestCase
def test_only_path
with_routing do |set|
set.draw do |map|
- map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index'
+ match 'home/sweet/home/:user', :to => 'home#index', :as => :home
map.connect ':controller/:action/:id'
end
@@ -334,7 +333,6 @@ class UrlWriterTests < ActionController::TestCase
set.draw do |map|
map.main '', :controller => 'posts', :format => nil
map.resources :posts
- map.connect ':controller/:action/:id'
end
# We need to create a new class in order to install the new named route.
diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb
index 1a9eb65f29..63e8cf3e61 100644
--- a/actionpack/test/controller/verification_test.rb
+++ b/actionpack/test/controller/verification_test.rb
@@ -125,8 +125,8 @@ class VerificationTest < ActionController::TestCase
assert_not_deprecated do
with_routing do |set|
set.draw do |map|
- map.foo '/foo', :controller => 'test', :action => 'foo'
- map.connect ":controller/:action/:id"
+ match 'foo', :to => 'test#foo', :as => :foo
+ match 'verification_test/:action', :to => TestController
end
get :guarded_one_for_named_route_test, :two => "not one"
assert_redirected_to '/foo'