aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/console_app.rb1
-rw-r--r--railties/lib/rails/generators/actions.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/routes.rb57
-rw-r--r--railties/lib/rails/generators/rails/resource/resource_generator.rb2
-rw-r--r--railties/lib/rails/generators/rails/scaffold/USAGE2
-rw-r--r--railties/lib/rails/test_help.rb6
-rw-r--r--railties/test/application/configuration_test.rb4
-rw-r--r--railties/test/fixtures/plugins/engines/engine/config/routes.rb2
-rw-r--r--railties/test/generators/actions_test.rb2
-rw-r--r--railties/test/generators/resource_generator_test.rb6
-rw-r--r--railties/test/generators/scaffold_generator_test.rb4
-rw-r--r--railties/test/rails_info_controller_test.rb3
12 files changed, 58 insertions, 33 deletions
diff --git a/railties/lib/rails/console_app.rb b/railties/lib/rails/console_app.rb
index 1ad62e5058..9a51d594d3 100644
--- a/railties/lib/rails/console_app.rb
+++ b/railties/lib/rails/console_app.rb
@@ -1,6 +1,7 @@
require 'active_support/all'
require 'active_support/test_case'
require 'action_controller'
+require 'action_dispatch/test_case'
# work around the at_exit hook in test/unit, which kills IRB
Test::Unit.run = true if Test::Unit.respond_to?(:run=)
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 57abc151d2..2efdf29127 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -269,7 +269,7 @@ module Rails
#
# === Example
#
- # route "map.root :controller => :welcome"
+ # route "root :to => 'welcome'"
#
def route(routing_code)
log :route, routing_code
diff --git a/railties/lib/rails/generators/rails/app/templates/config/routes.rb b/railties/lib/rails/generators/rails/app/templates/config/routes.rb
index ea14ce1bfc..e0f9ca8a12 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/routes.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/routes.rb
@@ -1,43 +1,60 @@
ActionController::Routing::Routes.draw do |map|
- # The priority is based upon order of creation: first created -> highest priority.
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
# Sample of regular route:
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
+ # match 'products/:id', :to => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
- # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
+ # match 'products/:id/purchase', :to => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
- # map.resources :products
+ # resources :products
# Sample resource route with options:
- # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
+ # resources :products do
+ # member do
+ # get :short
+ # post :toggle
+ # end
+ #
+ # collection do
+ # get :sold
+ # end
+ # end
# Sample resource route with sub-resources:
- # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
-
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
# Sample resource route with more complex sub-resources
- # map.resources :products do |products|
- # products.resources :comments
- # products.resources :sales, :collection => { :recent => :get }
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get :recent, :on => :collection
+ # end
# end
# Sample resource route within a namespace:
- # map.namespace :admin do |admin|
- # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
- # admin.resources :products
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
# end
- # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
- # map.root :controller => "welcome"
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome"
# See how all your routes lay out with "rake routes"
- # Install the default routes as the lowest priority.
- # Note: These default routes make all actions in every controller accessible via GET requests. You should
- # consider removing or commenting them out if you're using named routes and resources.
- map.connect ':controller/:action/:id'
- map.connect ':controller/:action/:id.:format'
+ # Install the default route as the lowest priority.
+ # Note: The default route make all actions in every controller accessible
+ # via GET requests. You should consider removing or commenting it out if
+ # you're using named routes and resources.
+ match ':controller(/:action(/:id(.:format)))'
end
diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/rails/generators/rails/resource/resource_generator.rb
index e49f9aea1b..a89ce7faed 100644
--- a/railties/lib/rails/generators/rails/resource/resource_generator.rb
+++ b/railties/lib/rails/generators/rails/resource/resource_generator.rb
@@ -16,7 +16,7 @@ module Rails
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
def add_resource_route
- route "map.resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}"
+ route "resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}"
end
protected
diff --git a/railties/lib/rails/generators/rails/scaffold/USAGE b/railties/lib/rails/generators/rails/scaffold/USAGE
index 71edd2f469..530ccdaf0a 100644
--- a/railties/lib/rails/generators/rails/scaffold/USAGE
+++ b/railties/lib/rails/generators/rails/scaffold/USAGE
@@ -17,7 +17,7 @@ Description:
For example, 'scaffold post title:string body:text published:boolean'
gives you a model with those three attributes, a controller that handles
the create/show/update/destroy, forms to create and edit your posts, and
- an index that lists them all, as well as a map.resources :posts
+ an index that lists them all, as well as a resources :posts
declaration in config/routes.rb.
If you want to remove all the generated files, run
diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb
index 9f6c42945f..0bf5f5c625 100644
--- a/railties/lib/rails/test_help.rb
+++ b/railties/lib/rails/test_help.rb
@@ -8,8 +8,14 @@ gem "rack-test", "~> 0.5.0"
require 'test/unit'
require 'active_support/core_ext/kernel/requires'
+
+# AP is always present
+require 'action_controller/test_case'
require 'action_view/test_case'
+require 'action_dispatch/test_case'
+
require 'action_mailer/test_case' if defined?(ActionMailer)
+require 'active_model/test_case' if defined?(ActiveModel)
if defined?(ActiveRecord)
require 'active_record/test_case'
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index fc21d4e5fd..1fcab8c651 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -50,8 +50,8 @@ module ApplicationTests
Dir.chdir("#{app_path}/app") do
require "#{app_path}/config/environment"
- assert_raises(NoMethodError, /day/) { 1.day }
+ assert_raises(NoMethodError) { 1.day }
end
end
end
-end \ No newline at end of file
+end
diff --git a/railties/test/fixtures/plugins/engines/engine/config/routes.rb b/railties/test/fixtures/plugins/engines/engine/config/routes.rb
index cca8d1b146..da44595693 100644
--- a/railties/test/fixtures/plugins/engines/engine/config/routes.rb
+++ b/railties/test/fixtures/plugins/engines/engine/config/routes.rb
@@ -1,3 +1,3 @@
ActionController::Routing::Routes.draw do |map|
- map.connect '/engine', :controller => "engine"
+ match '/engine', :to => "engine"
end
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index 7d03a37f2a..b69f23c965 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -171,7 +171,7 @@ class ActionsTest < GeneratorsTestCase
def test_route_should_add_data_to_the_routes_block_in_config_routes
run_generator
- route_command = "map.route '/login', :controller => 'sessions', :action => 'new'"
+ route_command = "route '/login', :controller => 'sessions', :action => 'new'"
action :route, route_command
assert_file 'config/routes.rb', /#{Regexp.escape(route_command)}/
end
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb
index 886af01b22..dff3908ea1 100644
--- a/railties/test/generators/resource_generator_test.rb
+++ b/railties/test/generators/resource_generator_test.rb
@@ -62,7 +62,7 @@ class ResourceGeneratorTest < GeneratorsTestCase
run_generator
assert_file "config/routes.rb" do |route|
- assert_match /map\.resources :accounts$/, route
+ assert_match /resources :accounts$/, route
end
end
@@ -70,7 +70,7 @@ class ResourceGeneratorTest < GeneratorsTestCase
run_generator ["account", "--singleton"]
assert_file "config/routes.rb" do |route|
- assert_match /map\.resource :account$/, route
+ assert_match /resource :account$/, route
end
end
@@ -93,7 +93,7 @@ class ResourceGeneratorTest < GeneratorsTestCase
run_generator ["account"], :behavior => :revoke
assert_file "config/routes.rb" do |route|
- assert_no_match /map\.resources :accounts$/, route
+ assert_no_match /resources :accounts$/, route
end
end
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index c0652c034f..0b961cee19 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -25,7 +25,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase
# Route
assert_file "config/routes.rb" do |route|
- assert_match /map\.resources :product_lines$/, route
+ assert_match /resources :product_lines$/, route
end
# Controller
@@ -99,7 +99,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase
# Route
assert_file "config/routes.rb" do |route|
- assert_no_match /map\.resources :product_lines$/, route
+ assert_no_match /resources :product_lines$/, route
end
# Controller
diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb
index 39f23fa0be..435bd34925 100644
--- a/railties/test/rails_info_controller_test.rb
+++ b/railties/test/rails_info_controller_test.rb
@@ -1,5 +1,6 @@
require 'abstract_unit'
require 'action_controller'
+require 'action_controller/test_case'
require 'rails/info'
require 'rails/info_controller'
@@ -15,7 +16,7 @@ class InfoControllerTest < ActionController::TestCase
def setup
ActionController::Routing::Routes.draw do |map|
- map.connect ':controller/:action/:id'
+ match ':controller/:action'
end
@controller.stubs(:consider_all_requests_local => false, :local_request? => true)
end