mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 23:08:05 -05:00
More compatibility with Rails master.
This commit is contained in:
2
.bundle/config
Normal file
2
.bundle/config
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
BUNDLE_WITHOUT: ""
|
||||
@@ -60,8 +60,8 @@ module Devise
|
||||
@@password_length = 6..20
|
||||
|
||||
# Email regex used to validate email formats. Adapted from authlogic.
|
||||
mattr_accessor :email_regex
|
||||
@@email_regex = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
||||
mattr_accessor :email_regexp
|
||||
@@email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
||||
|
||||
# Time interval where the remember me token is valid.
|
||||
mattr_accessor :remember_for
|
||||
|
||||
@@ -16,7 +16,7 @@ module Devise
|
||||
base.class_eval do
|
||||
validates_presence_of :email
|
||||
validates_uniqueness_of :email, :scope => authentication_keys[1..-1], :allow_blank => true
|
||||
validates_format_of :email, :with => Devise.email_regex, :allow_blank => true
|
||||
validates_format_of :email, :with => Devise.email_regexp, :allow_blank => true
|
||||
|
||||
with_options :if => :password_required? do |v|
|
||||
v.validates_presence_of :password
|
||||
|
||||
@@ -76,7 +76,11 @@ module Devise
|
||||
def changed?
|
||||
dirty?
|
||||
end
|
||||
|
||||
|
||||
def new_record?
|
||||
new?
|
||||
end
|
||||
|
||||
def save(options=nil)
|
||||
if options.is_a?(Hash) && options[:validate] == false
|
||||
save
|
||||
|
||||
@@ -3,8 +3,6 @@ require 'devise/rails/warden_compat'
|
||||
|
||||
module Devise
|
||||
class Engine < ::Rails::Engine
|
||||
engine_name :devise
|
||||
|
||||
initializer "devise.add_middleware" do |app|
|
||||
app.config.middleware.use Warden::Manager do |config|
|
||||
Devise.configure_warden(config)
|
||||
|
||||
@@ -43,7 +43,7 @@ Devise.setup do |config|
|
||||
# config.password_length = 6..20
|
||||
|
||||
# Regex to use to validate the email address
|
||||
# config.email_regex = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
||||
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
||||
|
||||
# ==> Configuration for :timeoutable
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
ActiveRecord::Migration.verbose = false
|
||||
ActiveRecord::Base.logger = Logger.new(nil)
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
DataMapper.auto_migrate!
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
Mongoid.configure do |config|
|
||||
config.master = Mongo::Connection.new('127.0.0.1', 27017).db("devise-test-suite")
|
||||
end
|
||||
|
||||
I18n.load_path << File.join(
|
||||
File.dirname(__FILE__), "mongoid", "locale", "en.yml"
|
||||
)
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
setup do
|
||||
User.delete_all
|
||||
|
||||
@@ -28,5 +28,9 @@ module RailsApp
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
config.filter_parameters << :password
|
||||
|
||||
# Cookie settings
|
||||
config.cookie_secret = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
|
||||
config.session_store :cookie_store, :key => "_my_app"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ begin
|
||||
rescue LoadError
|
||||
require 'rubygems'
|
||||
require 'bundler'
|
||||
Bundler.setup
|
||||
Bundler.setup :default, DEVISE_ORM
|
||||
end
|
||||
|
||||
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
||||
@@ -1,7 +0,0 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
ActionController::Base.cookie_verifier_secret = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
|
||||
@@ -1,15 +0,0 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key for verifying cookie session data integrity.
|
||||
# If you change this key, all old sessions will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
ActionController::Base.session = {
|
||||
:key => '_rails_app_session',
|
||||
:secret => '0c31f123b2bd4424ac366a7976aaa0696f0c82337c4073a5816a3abc6553293ad14f70cf23acb391954a8ce8cf08aaca3fab21e7642aa52ea212aefa19b7439d'
|
||||
}
|
||||
|
||||
# Use the database for sessions instead of the cookie-based default,
|
||||
# which shouldn't be used to store highly confidential information
|
||||
# (create the session table with "rake db:sessions:create")
|
||||
# ActionController::Base.session_store = :active_record_store
|
||||
@@ -1,11 +1,14 @@
|
||||
ENV["RAILS_ENV"] = "test"
|
||||
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
||||
|
||||
$:.unshift File.dirname(__FILE__)
|
||||
puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
|
||||
|
||||
require File.expand_path('../rails_app/config/application', __FILE__)
|
||||
require File.expand_path("../orm/#{DEVISE_ORM}", __FILE__)
|
||||
require "rails_app/config/environment"
|
||||
require "rails/test_help"
|
||||
require "orm/#{DEVISE_ORM}"
|
||||
|
||||
I18n.load_path << File.expand_path("../support/locale/en.yml", __FILE__)
|
||||
require 'mocha'
|
||||
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
|
||||
Reference in New Issue
Block a user