From 6258f7c972f0dcf85916a0ac9ce3d34460201353 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 7 Sep 2010 14:53:37 +0200 Subject: Change app to main_app in mounted_helpers --- railties/test/application/initializers/frameworks_test.rb | 2 +- railties/test/railties/engine_test.rb | 2 +- railties/test/railties/mounted_engine_test.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/test') diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index 6e9ceb6ef7..da8ae17518 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -61,7 +61,7 @@ module ApplicationTests require "#{app_path}/config/environment" assert Foo.method_defined?(:foo_path) - assert Foo.method_defined?(:app) + assert Foo.method_defined?(:main_app) assert_equal ["notify"], Foo.action_methods end diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index fabd561bd2..370f9342e3 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -437,7 +437,7 @@ module RailtiesTest end def routes_helpers_in_view - render :inline => "<%= foo_path %>, <%= app.bar_path %>" + render :inline => "<%= foo_path %>, <%= main_app.bar_path %>" end def polymorphic_path_without_namespace diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb index 73b7e5b2e0..b52ced92ec 100644 --- a/railties/test/railties/mounted_engine_test.rb +++ b/railties/test/railties/mounted_engine_test.rb @@ -70,14 +70,14 @@ module ApplicationTests end def generate_application_route - path = app.url_for(:controller => "/main", + path = main_app.url_for(:controller => "/main", :action => "index", :only_path => true) render :text => path end def application_route_in_view - render :inline => "<%= app.root_path %>" + render :inline => "<%= main_app.root_path %>" end end end -- cgit v1.2.3 From 36fcb776dda9a3dd0839febd0a4663320d1944db Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 7 Sep 2010 22:15:07 +0200 Subject: Fix warning by removing |map| from routes.draw --- railties/test/application/routing_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb index d0c6cb51ca..b4ff14409f 100644 --- a/railties/test/application/routing_test.rb +++ b/railties/test/application/routing_test.rb @@ -203,7 +203,7 @@ module ApplicationTests assert_equal 'bar', last_response.body app_file 'config/routes.rb', <<-RUBY - AppTemplate::Application.routes.draw do |map| + AppTemplate::Application.routes.draw do match 'foo', :to => 'foo#baz' end RUBY -- cgit v1.2.3 From 497b6af8818f656fdbca9ed2470c1c16ae5ff1cd Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 7 Sep 2010 22:59:09 +0200 Subject: Set default asset_path only for engine --- railties/test/railties/engine_test.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'railties/test') diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 370f9342e3..6fc166e054 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -281,6 +281,34 @@ module RailtiesTest assert_equal expected, stripped_body end + test "default application's asset_path" do + @plugin.write "config/routes.rb", <<-RUBY + Bukkits::Engine.routes.draw do + match "/foo" => "foo#index" + end + RUBY + + @plugin.write "app/controllers/foo_controller.rb", <<-RUBY + class FooController < ActionController::Base + def index + end + end + RUBY + + @plugin.write "app/views/foo/index.html.erb", <<-RUBY + <%= compute_public_path("/foo", "") %> + RUBY + + boot_rails + + env = Rack::MockRequest.env_for("/foo") + response = Bukkits::Engine.call(env) + stripped_body = response[2].body.strip + + expected = "/bukkits/foo" + assert_equal expected, stripped_body + end + test "engine's files are served via ActionDispatch::Static" do add_to_config "config.serve_static_assets = true" -- cgit v1.2.3