aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-07-20 02:32:23 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-07-20 02:32:37 -0300
commita8a3a8cc691facad4ba7487a7b66362b498720c9 (patch)
treeedd761712a1f6e01fa6c8801fd670402ef5d1c57 /railties/test
parentf980dee24eb500e2a8a6e25b2fd13dbe2ce5b62d (diff)
parente5a6f7ee9e951dbe0e4e9ea2c0743b4dfb135c57 (diff)
downloadrails-a8a3a8cc691facad4ba7487a7b66362b498720c9.tar.gz
rails-a8a3a8cc691facad4ba7487a7b66362b498720c9.tar.bz2
rails-a8a3a8cc691facad4ba7487a7b66362b498720c9.zip
Merge pull request #25438 from prathamesh-sonpatki/rm-session-store-initializer
Setup default session store internally, no longer through an initializer
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/configuration_test.rb16
-rw-r--r--railties/test/generators/api_app_generator_test.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb10
3 files changed, 16 insertions, 11 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index e1c6f214ab..e4a3adee9f 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1186,6 +1186,22 @@ module ApplicationTests
end
end
+ test "default session store initializer does not overwrite the user defined session store even if it is disabled" do
+ make_basic_app do |application|
+ application.config.session_store :disabled
+ end
+
+ assert_equal nil, app.config.session_store
+ end
+
+ test "default session store initializer sets session store to cookie store" do
+ session_options = { key: "_myapp_session", cookie_only: true }
+ make_basic_app
+
+ assert_equal ActionDispatch::Session::CookieStore, app.config.session_store
+ assert_equal session_options, app.config.session_options
+ end
+
test "config.log_level with custom logger" do
make_basic_app do |application|
application.config.logger = Logger.new(STDOUT)
diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb
index 92779452e1..9ad936710d 100644
--- a/railties/test/generators/api_app_generator_test.rb
+++ b/railties/test/generators/api_app_generator_test.rb
@@ -108,7 +108,6 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase
app/views/layouts/application.html.erb
config/initializers/assets.rb
config/initializers/cookies_serializer.rb
- config/initializers/session_store.rb
lib/assets
vendor/assets
test/helpers
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index ac1488abb3..50751368c8 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -131,7 +131,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
generator.send(:app_const)
quietly { generator.send(:update_config_files) }
assert_file "myapp_moved/config/environment.rb", /Rails\.application\.initialize!/
- assert_file "myapp_moved/config/initializers/session_store.rb", /_myapp_session/
end
end
end
@@ -144,7 +143,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
generator = Rails::Generators::AppGenerator.new ["rails"], [], destination_root: app_root, shell: @shell
generator.send(:app_const)
quietly { generator.send(:update_config_files) }
- assert_file "myapp/config/initializers/session_store.rb", /_myapp_session/
end
end
@@ -552,13 +550,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "config/application.rb", /\s+require\s+["']active_job\/railtie["']/
end
- def test_new_hash_style
- run_generator
- assert_file "config/initializers/session_store.rb" do |file|
- assert_match(/config.session_store :cookie_store, key: '_.+_session'/, file)
- end
- end
-
def test_pretend_option
output = run_generator [File.join(destination_root, "myapp"), "--pretend"]
assert_no_match(/run bundle install/, output)
@@ -571,7 +562,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
run_generator [path, "-d", 'postgresql']
assert_file "foo bar/config/database.yml", /database: foo_bar_development/
- assert_file "foo bar/config/initializers/session_store.rb", /key: '_foo_bar/
end
def test_web_console