aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract_controller/abstract_controller_test.rb60
-rw-r--r--actionpack/test/abstract_controller/views/index.erb1
2 files changed, 61 insertions, 0 deletions
diff --git a/actionpack/test/abstract_controller/abstract_controller_test.rb b/actionpack/test/abstract_controller/abstract_controller_test.rb
new file mode 100644
index 0000000000..a5026fb0da
--- /dev/null
+++ b/actionpack/test/abstract_controller/abstract_controller_test.rb
@@ -0,0 +1,60 @@
+$:.unshift(File.dirname(__FILE__) + '/../../lib')
+$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
+
+require 'test/unit'
+require 'active_support'
+require 'active_support/test_case'
+require 'action_controller'
+
+begin
+ require 'ruby-debug'
+ Debugger.settings[:autoeval] = true
+ Debugger.start
+rescue LoadError
+ # Debugging disabled. `gem install ruby-debug` to enable.
+end
+
+require 'action_controller/abstract/base'
+require 'action_controller/abstract/renderer'
+
+module AbstractController
+ module Testing
+
+ class SimpleController < AbstractController::Base
+ end
+
+ class Me < SimpleController
+ def index
+ self.response_body = "Hello world"
+ "Something else"
+ end
+ end
+
+ class TestBasic < ActiveSupport::TestCase
+ test "dispatching works" do
+ result = Me.process(:index)
+ assert_equal "Hello world", result.response_obj[:body]
+ end
+ end
+
+ class RenderingController < AbstractController::Base
+ include Renderer
+
+ append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views"))
+ end
+
+ class Me2 < RenderingController
+ def index
+ render "index.erb"
+ end
+ end
+
+ class TestRenderer < ActiveSupport::TestCase
+ test "rendering templates works" do
+ result = Me2.process(:index)
+ assert_equal "Hello from index.erb", result.response_obj[:body]
+ end
+ end
+
+ end
+end \ No newline at end of file
diff --git a/actionpack/test/abstract_controller/views/index.erb b/actionpack/test/abstract_controller/views/index.erb
new file mode 100644
index 0000000000..cc1a8b8c85
--- /dev/null
+++ b/actionpack/test/abstract_controller/views/index.erb
@@ -0,0 +1 @@
+Hello from index.erb \ No newline at end of file