Sha256: f2f1f5eff0b610d4c0d3bfddbfd8d855d459a1431edcaa7ae76c251b27552207

Contents?: true

Size: 931 Bytes

Versions: 25

Compression:

Stored size: 931 Bytes

Contents

if DEVISE_ORM == :mongoid

  require 'test_helper'

  class User2
    include Mongoid::Document
    devise :database_authenticatable
  end

  class User3
    include Mongoid::Document
    devise :database_authenticatable, :authentication_keys => [:username, :email]
   end

  class User4
    include Mongoid::Document
    devise :database_authenticatable, :authentication_keys => [:username]
  end

  class SchemaTest < ActiveSupport::TestCase
    test 'should create an email field if there are no custom authentication keys' do
      assert_not_equal User2.fields['email'], nil
    end

    test 'should create an email field if there are custom authentication keys and they include email' do
      assert_not_equal User3.fields['email'], nil
    end

    test 'should not create an email field if there are custom authentication keys they don\'t include email' do
      assert_equal User4.fields['email'], nil
    end
  end
end

Version data entries

25 entries across 24 versions & 3 rubygems

Version Path
devise-1.2.1 test/schema_test.rb
devise-1.2.0 test/schema_test.rb
devise-jdguyot-1.2.rc3 test/schema_test.rb
devise-1.2.rc2 test/schema_test.rb
devise-jdguyot-1.2.rc2 test/schema_test.rb