aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-21 14:04:04 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-21 14:04:04 -0300
commit8a8325766a870df0abcf4662fb71660173737253 (patch)
tree4f71478f3ee6899dfa80bbffd7a7457782f1cfb4 /railties/test
parentd5977c67bdd6a459e21328cb8c0cf2cf47ccc185 (diff)
downloadrails-8a8325766a870df0abcf4662fb71660173737253.tar.gz
rails-8a8325766a870df0abcf4662fb71660173737253.tar.bz2
rails-8a8325766a870df0abcf4662fb71660173737253.zip
Keep all session tests in the same file
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/middleware/flash_test.rb46
-rw-r--r--railties/test/application/middleware/session_test.rb28
2 files changed, 28 insertions, 46 deletions
diff --git a/railties/test/application/middleware/flash_test.rb b/railties/test/application/middleware/flash_test.rb
deleted file mode 100644
index f5d459c695..0000000000
--- a/railties/test/application/middleware/flash_test.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require 'isolation/abstract_unit'
-require 'rack/test'
-
-module ApplicationTests
- class FlashTest < ActiveSupport::TestCase
- include ActiveSupport::Testing::Isolation
- include Rack::Test::Methods
-
- def setup
- build_app
- boot_rails
- end
-
- def teardown
- teardown_app
- end
-
- test 'calling reset_session on request does not trigger an error for API apps' do
- add_to_config 'config.api_only = true'
-
- controller :test, <<-RUBY
- class TestController < ApplicationController
- def dump_flash
- request.reset_session
- render plain: 'It worked!'
- end
- end
- RUBY
-
- app_file 'config/routes.rb', <<-RUBY
- Rails.application.routes.draw do
- get '/dump_flash' => "test#dump_flash"
- end
- RUBY
-
- app 'development'
-
- get '/dump_flash'
-
- assert_equal 200, last_response.status
- assert_equal 'It worked!', last_response.body
-
- refute Rails.application.middleware.include?(ActionDispatch::Flash)
- end
- end
-end
diff --git a/railties/test/application/middleware/session_test.rb b/railties/test/application/middleware/session_test.rb
index f847e80471..85e7761727 100644
--- a/railties/test/application/middleware/session_test.rb
+++ b/railties/test/application/middleware/session_test.rb
@@ -345,5 +345,33 @@ module ApplicationTests
get '/foo/read_raw_cookie'
assert_equal 2, verifier.verify(last_response.body)['foo']
end
+
+ test 'calling reset_session on request does not trigger an error for API apps' do
+ add_to_config 'config.api_only = true'
+
+ controller :test, <<-RUBY
+ class TestController < ApplicationController
+ def dump_flash
+ request.reset_session
+ render plain: 'It worked!'
+ end
+ end
+ RUBY
+
+ app_file 'config/routes.rb', <<-RUBY
+ Rails.application.routes.draw do
+ get '/dump_flash' => "test#dump_flash"
+ end
+ RUBY
+
+ require "#{app_path}/config/environment"
+
+ get '/dump_flash'
+
+ assert_equal 200, last_response.status
+ assert_equal 'It worked!', last_response.body
+
+ refute Rails.application.middleware.include?(ActionDispatch::Flash)
+ end
end
end