aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-03-26 15:10:24 -0700
committerwycats <wycats@gmail.com>2010-03-26 15:10:24 -0700
commit197904341f2b2f21d69c653cede3aec124e86720 (patch)
tree83f1234e238016126860a929594db22e1862d783 /railties/test/application
parent76d2c455c0607b4cd5f238cadef8f933a18567fb (diff)
parentb3a0aed028835ce4551c4a76742744a40a71b0be (diff)
downloadrails-197904341f2b2f21d69c653cede3aec124e86720.tar.gz
rails-197904341f2b2f21d69c653cede3aec124e86720.tar.bz2
rails-197904341f2b2f21d69c653cede3aec124e86720.zip
Merge branch 'master' into docrails
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/configuration_test.rb27
-rw-r--r--railties/test/application/paths_test.rb18
2 files changed, 27 insertions, 18 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 54cd751f4e..1b6c657d6d 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -228,5 +228,32 @@ module ApplicationTests
get "/"
assert_equal File.expand_path(__FILE__), last_response.headers["X-Lighttpd-Send-File"]
end
+
+ test "protect from forgery is the default in a new app" do
+ require "rails"
+ require "action_controller/railtie"
+
+ class MyApp < Rails::Application
+ config.session_store :disabled
+
+ routes.draw do
+ match "/" => "omg#index"
+ end
+
+ class ::OmgController < ActionController::Base
+ protect_from_forgery
+
+ def index
+ render :inline => "<%= csrf_meta_tag %>"
+ end
+ end
+ end
+
+ require 'rack/test'
+ extend Rack::Test::Methods
+
+ get "/"
+ assert last_response.body =~ /csrf\-param/
+ end
end
end
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 511b8b629a..589e515d05 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -51,8 +51,6 @@ module ApplicationTests
assert_path @paths.config.environment, "config", "environments", "development.rb"
assert_equal root("app", "controllers"), @paths.app.controllers.to_a.first
- assert_equal Pathname.new(File.dirname(__FILE__)).join("..", "..", "builtin", "rails_info").expand_path,
- Pathname.new(@paths.app.controllers.to_a[1]).expand_path
end
test "booting up Rails yields a list of paths that are eager" do
@@ -80,21 +78,5 @@ module ApplicationTests
assert_not_in_load_path "tmp"
assert_not_in_load_path "tmp", "cache"
end
-
- test "controller paths include builtin in development mode" do
- Rails.env.replace "development"
- assert Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ }
- end
-
- test "controller paths does not have builtin_directories in test mode" do
- Rails.env.replace "test"
- assert !Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ }
- end
-
- test "controller paths does not have builtin_directories in production mode" do
- Rails.env.replace "production"
- assert !Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ }
- end
-
end
end