diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-01-25 11:25:11 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-01-25 11:25:11 -0800 |
commit | 6dfab475ca230dfcad7a603483431c8e7a8f908e (patch) | |
tree | 69ca8ade43b0e39e1d8cffa68390e9052e589acf /actionpack/test | |
parent | 14e92bac1a4c199e5e8936c6bdc64420293ea6d1 (diff) | |
parent | 908c011395cc9e3ea1bb195f9d1bd30a9d9df98f (diff) | |
download | rails-6dfab475ca230dfcad7a603483431c8e7a8f908e.tar.gz rails-6dfab475ca230dfcad7a603483431c8e7a8f908e.tar.bz2 rails-6dfab475ca230dfcad7a603483431c8e7a8f908e.zip |
Merge branch '5-0-beta-sec'
* 5-0-beta-sec:
bumping version
fix version update task to deal with .beta1.1
Eliminate instance level writers for class accessors
allow :file to be outside rails root, but anything else must be inside the rails view directory
Don't short-circuit reject_if proc
stop caching mime types globally
use secure string comparisons for basic auth username / password
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 990e5813a8..3f569230c2 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -62,6 +62,16 @@ class TestController < ActionController::Base end end + def dynamic_render + render params[:id] # => String, AC:Params + end + + def dynamic_render_with_file + # This is extremely bad, but should be possible to do. + file = params[:id] # => String, AC:Params + render file: file + end + class Collection def initialize(records) @records = records @@ -243,6 +253,27 @@ end class ExpiresInRenderTest < ActionController::TestCase tests TestController + def test_dynamic_render_with_file + # This is extremely bad, but should be possible to do. + assert File.exist?(File.join(File.dirname(__FILE__), '../../test/abstract_unit.rb')) + response = get :dynamic_render_with_file, params: { id: '../\\../test/abstract_unit.rb' } + assert_equal File.read(File.join(File.dirname(__FILE__), '../../test/abstract_unit.rb')), + response.body + end + + def test_dynamic_render + assert File.exist?(File.join(File.dirname(__FILE__), '../../test/abstract_unit.rb')) + assert_raises ActionView::MissingTemplate do + get :dynamic_render, params: { id: '../\\../test/abstract_unit.rb' } + end + end + + def test_dynamic_render_file_hash + assert_raises ArgumentError do + get :dynamic_render, params: { id: { file: '../\\../test/abstract_unit.rb' } } + end + end + def test_expires_in_header get :conditional_hello_with_expires_in assert_equal "max-age=60, private", @response.headers["Cache-Control"] |