aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/initializers
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-06-11 17:44:06 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2015-06-11 17:44:06 -0300
commit21f7bcbaa7709ed072bb2e1273d25c09eeaa26d9 (patch)
tree14b91132cbe37e1b3bc6c8af41a8804b8163edac /railties/test/application/initializers
parented7d787e120347ebc97647014a5e1fef7a34c19c (diff)
parent51d5d6252ee093d3fa004abec79319ae8b4c42c4 (diff)
downloadrails-21f7bcbaa7709ed072bb2e1273d25c09eeaa26d9.tar.gz
rails-21f7bcbaa7709ed072bb2e1273d25c09eeaa26d9.tar.bz2
rails-21f7bcbaa7709ed072bb2e1273d25c09eeaa26d9.zip
Merge pull request #19832 from spastorino/rails-api
Rails api
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..af98e08d0e 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"