aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/initializers
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-04-16 15:18:40 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2015-06-11 16:54:10 -0300
commit212a099ab022fe617d94f195423432dad5cdb21a (patch)
tree834e3d689f9c1c7a9ea3eda4bfe9243cabce405a /railties/test/application/initializers
parent135c059d6f0664991f158d358a4312e550ead7a6 (diff)
downloadrails-212a099ab022fe617d94f195423432dad5cdb21a.tar.gz
rails-212a099ab022fe617d94f195423432dad5cdb21a.tar.bz2
rails-212a099ab022fe617d94f195423432dad5cdb21a.zip
Add AC::API + its middleware stack integration test
Diffstat (limited to 'railties/test/application/initializers')
-rw-r--r--railties/test/application/initializers/frameworks_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb
index 97b51911d9..709286d728 100644
--- a/railties/test/application/initializers/frameworks_test.rb
+++ b/railties/test/application/initializers/frameworks_test.rb
@@ -129,6 +129,35 @@ module ApplicationTests
assert_equal "false", last_response.body
end
+ test "action_controller api executes using all the middleware stack" do
+ add_to_config "config.api_only = true"
+
+ app_file "app/controllers/application_controller.rb", <<-RUBY
+ class ApplicationController < ActionController::API
+ end
+ RUBY
+
+ app_file "app/controllers/omg_controller.rb", <<-RUBY
+ class OmgController < ApplicationController
+ def show
+ render :json => { :omg => 'omg' }
+ end
+ end
+ RUBY
+
+ app_file "config/routes.rb", <<-RUBY
+ Rails.application.routes.draw do
+ get "/:controller(/:action)"
+ end
+ RUBY
+
+ require 'rack/test'
+ extend Rack::Test::Methods
+
+ get 'omg/show'
+ assert_equal '{"omg":"omg"}', last_response.body
+ end
+
# AD
test "action_dispatch extensions are applied to ActionDispatch" do
add_to_config "config.action_dispatch.tld_length = 2"