diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-06 07:11:06 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-06 07:11:06 +0200 |
commit | 785ee65ddfc3cd361ea2a0dbde3bfb908ed62192 (patch) | |
tree | 181ef88264be89373ec821e634558d1b0d4da0c9 /railties | |
parent | 41a6d96c1bced4a2e4cba20b8c209c52656f59cf (diff) | |
download | rails-785ee65ddfc3cd361ea2a0dbde3bfb908ed62192.tar.gz rails-785ee65ddfc3cd361ea2a0dbde3bfb908ed62192.tar.bz2 rails-785ee65ddfc3cd361ea2a0dbde3bfb908ed62192.zip |
Ensure params wrapper settings are not inherited and calculated each time.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/application/configuration_test.rb | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b1f7076776..6193e72625 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -12,7 +12,6 @@ end class ::MyOtherMailObserver < ::MyMailObserver; end - module ApplicationTests class ConfigurationTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation @@ -437,10 +436,35 @@ module ApplicationTests app_file 'config/initializers/wrap_parameters.rb', <<-RUBY ActionController::Base.wrap_parameters :format => [:json] RUBY + + app_file 'app/models/post.rb', <<-RUBY + class Post + def self.column_names + %w(title) + end + end + RUBY + + app_file 'app/controllers/posts_controller.rb', <<-RUBY + class PostsController < ApplicationController + def index + render :text => params[:post].inspect + end + end + RUBY + + add_to_config <<-RUBY + routes.append do + resources :posts + end + RUBY + require "#{app_path}/config/environment" - require 'action_controller/base' + require "rack/test" + extend Rack::Test::Methods - assert_equal [:json], ActionController::Base._wrapper_options[:format] + post "/posts.json", '{ "title": "foo", "name": "bar" }', "CONTENT_TYPE" => "application/json" + assert_equal '{"title"=>"foo"}', last_response.body end test "config.action_dispatch.ignore_accept_header" do |