Skip to content

Commit

Permalink
Keep all session tests in the same file
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Mar 21, 2016
1 parent d5977c6 commit 8a83257
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 46 deletions.
46 changes: 0 additions & 46 deletions railties/test/application/middleware/flash_test.rb

This file was deleted.

28 changes: 28 additions & 0 deletions railties/test/application/middleware/session_test.rb
Expand Up @@ -345,5 +345,33 @@ def read_raw_cookie
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

0 comments on commit 8a83257

Please sign in to comment.