aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-08-25 15:08:45 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:13 +0200
commit16dcaf83681d9d84c26cfab23249a6f069ca5c08 (patch)
tree302c7379b7a557f0fd8d9c0eccb3005628171c90 /railties/test
parentb1c66f060bba22d16abf6d24d3df762c240e367c (diff)
downloadrails-16dcaf83681d9d84c26cfab23249a6f069ca5c08.tar.gz
rails-16dcaf83681d9d84c26cfab23249a6f069ca5c08.tar.bz2
rails-16dcaf83681d9d84c26cfab23249a6f069ca5c08.zip
Updated tests to use scope(:module => :engine_name) instead of namespace and updated mounted engine tests to actually use the namespacing
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/railties/engine_test.rb2
-rw-r--r--railties/test/railties/mounted_engine_test.rb49
2 files changed, 28 insertions, 23 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 6deca9cf1e..56f9eae8ca 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -390,7 +390,7 @@ module RailtiesTest
@plugin.write "config/routes.rb", <<-RUBY
Bukkits::Engine.routes.draw do
- namespace(:bukkits, :path => nil, :shallow_path => nil, :as => nil) do
+ scope(:module => :bukkits) do
match "/foo" => "foo#index", :as => "foo"
match "/foo/show" => "foo#show"
match "/from_app" => "foo#from_app"
diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb
index 174ccb4b4b..be5bb30a9a 100644
--- a/railties/test/railties/mounted_engine_test.rb
+++ b/railties/test/railties/mounted_engine_test.rb
@@ -19,7 +19,7 @@ module ApplicationTests
match "/engine_route_in_view" => "application_generating#engine_route_in_view"
match "/url_for_engine_route" => "application_generating#url_for_engine_route"
scope "/:user", :user => "anonymous" do
- mount Blog::Engine => "/blog", :as => "blog_engine"
+ mount Blog::Engine => "/blog"
end
root :to => 'main#index'
end
@@ -28,34 +28,39 @@ module ApplicationTests
@plugin.write "lib/blog.rb", <<-RUBY
module Blog
class Engine < ::Rails::Engine
+ namespace(Blog)
end
end
RUBY
@plugin.write "config/routes.rb", <<-RUBY
Blog::Engine.routes.draw do
- resources :posts do
- get :generate_application_route
- get :application_route_in_view
+ scope(:module => :blog) do
+ resources :posts do
+ get :generate_application_route
+ get :application_route_in_view
+ end
end
end
RUBY
- @plugin.write "app/controllers/posts_controller.rb", <<-RUBY
- class PostsController < ActionController::Base
- def index
- render :text => blog_engine.post_path(1)
- end
-
- def generate_application_route
- path = app.url_for(:controller => "main",
- :action => "index",
- :only_path => true)
- render :text => path
- end
-
- def application_route_in_view
- render :inline => "<%= app.root_path %>"
+ @plugin.write "app/controllers/blog/posts_controller.rb", <<-RUBY
+ module Blog
+ class PostsController < ActionController::Base
+ def index
+ render :text => blog.post_path(1)
+ end
+
+ def generate_application_route
+ path = app.url_for(:controller => "/main",
+ :action => "index",
+ :only_path => true)
+ render :text => path
+ end
+
+ def application_route_in_view
+ render :inline => "<%= app.root_path %>"
+ end
end
end
RUBY
@@ -63,15 +68,15 @@ module ApplicationTests
app_file "app/controllers/application_generating_controller.rb", <<-RUBY
class ApplicationGeneratingController < ActionController::Base
def engine_route
- render :text => blog_engine.posts_path
+ render :text => blog.posts_path
end
def engine_route_in_view
- render :inline => "<%= blog_engine.posts_path %>"
+ render :inline => "<%= blog.posts_path %>"
end
def url_for_engine_route
- render :text => blog_engine.url_for(:controller => "posts", :action => "index", :user => "john", :only_path => true)
+ render :text => blog.url_for(:controller => "blog/posts", :action => "index", :user => "john", :only_path => true)
end
end
RUBY