aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/loading_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-03-15 08:48:38 +0100
committerJosé Valim <jose.valim@gmail.com>2012-03-15 08:48:38 +0100
commitfbc9d0f44f090a9873834f4966760c3e80682559 (patch)
tree70a3a93f8af3653b0ed8557b9c385fc3f105bf18 /railties/test/application/loading_test.rb
parent5b94e73d1a604c59ecd1ebb9441d60ea864fa1b5 (diff)
downloadrails-fbc9d0f44f090a9873834f4966760c3e80682559.tar.gz
rails-fbc9d0f44f090a9873834f4966760c3e80682559.tar.bz2
rails-fbc9d0f44f090a9873834f4966760c3e80682559.zip
Simplify helpers handling. Ensure Metal can run AC hooks.
Diffstat (limited to 'railties/test/application/loading_test.rb')
-rw-r--r--railties/test/application/loading_test.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb
index 0354c08067..9302443c98 100644
--- a/railties/test/application/loading_test.rb
+++ b/railties/test/application/loading_test.rb
@@ -95,7 +95,7 @@ class LoadingTest < ActiveSupport::TestCase
assert_equal [ActiveRecord::SchemaMigration], ActiveRecord::Base.descendants
end
- test "initialize_cant_be_called_twice" do
+ test "initialize cant be called twice" do
require "#{app_path}/config/environment"
assert_raise(RuntimeError) { ::AppTemplate::Application.initialize! }
end
@@ -256,6 +256,35 @@ class LoadingTest < ActiveSupport::TestCase
assert_equal "BODY", last_response.body
end
+ test "AC load hooks can be used with metal" do
+ app_file "app/controllers/omg_controller.rb", <<-RUBY
+ begin
+ class OmgController < ActionController::Metal
+ ActiveSupport.run_load_hooks(:action_controller, self)
+ def show
+ self.response_body = ["OK"]
+ end
+ end
+ rescue => e
+ puts "Error loading metal: \#{e.class} \#{e.message}"
+ end
+ RUBY
+
+ app_file "config/routes.rb", <<-RUBY
+ AppTemplate::Application.routes.draw do
+ match "/:controller(/:action)"
+ end
+ RUBY
+
+ require "#{rails_root}/config/environment"
+
+ require 'rack/test'
+ extend Rack::Test::Methods
+
+ get '/omg/show'
+ assert_equal 'OK', last_response.body
+ end
+
protected
def setup_ar!