Merge pull request #24001 from 5t111111/fix-gsub-cookies_serializer

Fix description in cookies_serializer.rb being corrupted by gsub when updating
This commit is contained in:
Rafael França 2016-03-02 13:28:48 -03:00
commit 9a1cc04c90
2 changed files with 3 additions and 2 deletions

View File

@ -103,7 +103,7 @@ module Rails
end
unless cookie_serializer_config_exist
gsub_file 'config/initializers/cookies_serializer.rb', /json/, 'marshal'
gsub_file 'config/initializers/cookies_serializer.rb', /json(?!,)/, 'marshal'
end
unless active_record_belongs_to_required_by_default_config_exist

View File

@ -210,7 +210,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
generator = Rails::Generators::AppGenerator.new ["rails"], { with_dispatchers: true }, destination_root: app_root, shell: @shell
generator.send(:app_const)
quietly { generator.send(:update_config_files) }
assert_file("#{app_root}/config/initializers/cookies_serializer.rb", /Rails\.application\.config\.action_dispatch\.cookies_serializer = :marshal/)
assert_file("#{app_root}/config/initializers/cookies_serializer.rb",
/Valid options are :json, :marshal, and :hybrid\.\nRails\.application\.config\.action_dispatch\.cookies_serializer = :marshal/)
end
end