More compatibility with Rails master.

This commit is contained in:
José Valim
2010-03-28 07:15:52 +02:00
parent 6bcf18b04f
commit ea71be8d2a
15 changed files with 21 additions and 45 deletions

2
.bundle/config Normal file
View File

@@ -0,0 +1,2 @@
---
BUNDLE_WITHOUT: ""

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -1,4 +1 @@
require File.expand_path('../../rails_app/config/environment', __FILE__)
require 'rails/test_help'
DataMapper.auto_migrate!

View File

@@ -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

View File

@@ -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

View File

@@ -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__)

View 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'

View File

@@ -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

View File

@@ -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