0

Sorceryを使用するようにアプリケーションを設定しようとしています。ユーザーモデルに追加authenticates_with_sorcery!すると、スペックの実行が非常に遅くなります(1秒に約1回)。Sorceryでこれを引き起こす可能性のある何らかの構成またはセットアップはありますか?

これが私のユーザーモデルです:

# This model represents a user of the application, disregarding that person's use of the system. For
# instance, a user could be a job hunter, an employer, an administrator, or some other stakeholder.
class User < ActiveRecord::Base
  authenticates_with_sorcery!

  attr_accessible :email, :password, :password_confirmation

  # validations
  validates :email, 
            :presence => true, 
            :uniqueness => true, 
            :format => /[^@]+@[^@]+\.[^@]+/

  validates :password, :presence => true, :confirmation => true

  validates :password_confirmation, :presence => true

  # before filters
  before_save :sanitize_email

  private

  # Strips and removes HTML tags from the email parameter.
  def sanitize_email
    self.email = email.strip

    # remove anything that looks like an email
    self.email = email.gsub(/<[^<>]+>/, "")
  end
end

と私のユーザーファクトリ:

require 'factory_girl'
require 'ffaker'

FactoryGirl.define do

  sequence :email do |n|
    "email#{n}@example.com"
  end

  factory :user do |f|
    email
    password "password"
    password_confirmation "password"
  end
end
4

1 に答える 1

2

私の最初の推測は、パスワードの暗号化が遅いことです。たとえば、deviseにはconfig.stretches、テスト環境で少数に設定できる構成変数があります。

check deviseのdatabase_authenticatableの「ストレッチ」はどういう意味ですか?

于 2012-11-23T08:57:11.523 に答える