mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Fix specs on Rails 6 RC2 (#5109)
* Fix specs on Rails 6 RC2 `ActiveRecord::MigrationContext` now has a `schema_migration` attribute. Ref: https://github.com/rails/rails/pull/36439/files#diff-8d3c44120f7b67ff79e2fbe6a40d0ad6R1018 * Use `media_type` instead of `content_type` Before Rails 6 RC2, the `ActionDispatch::Response#content_type` method would return only the media part of the `Content-Type` header, without any other parts. Now the `#content_type` method returns the entire header - as it is - and `#media_type` should be used instead to get the previous behavior. Ref: - https://github.com/rails/rails/pull/36034 - https://github.com/rails/rails/pull/36854 * Use render template instead of render file Render file will need the full path in order to avoid security breaches. In this particular case, there's no need to use render file, it's ok to use render template. Ref: https://github.com/rails/rails/pull/35688 * Don't set `represent_boolean_as_integer` on Rails 6 * Update comments [ci skip]
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
Welcome to "sessions/new" view!
|
||||
<%= render file: "devise/sessions/new" %>
|
||||
<%= render template: "devise/sessions/new" %>
|
||||
|
||||
@@ -45,8 +45,8 @@ module RailsApp
|
||||
Devise::SessionsController.layout "application"
|
||||
end
|
||||
|
||||
# Remove this check once Rails 5.0 support is removed.
|
||||
if Devise::Test.rails52_and_up?
|
||||
# Remove the first check once Rails 5.0 support is removed.
|
||||
if Devise::Test.rails52_and_up? && !Devise::Test.rails6?
|
||||
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,8 +6,12 @@ end
|
||||
|
||||
module Devise
|
||||
module Test
|
||||
# Detection for minor differences between Rails 4 and 5, 5.1, and 5.2 in tests.
|
||||
# Detection for minor differences between Rails versions in tests.
|
||||
|
||||
def self.rails6?
|
||||
Rails.version.start_with? '6'
|
||||
end
|
||||
|
||||
def self.rails52_and_up?
|
||||
Rails::VERSION::MAJOR > 5 || rails52?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user