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_sociable-0.1.0 vendor/bundle/gems/devise-1.5.4/test/schema_test.rb
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.2.1/test/schema_test.rb
devise-1.5.4 test/schema_test.rb
devise-1.5.3 test/schema_test.rb
devise-1.5.2 test/schema_test.rb
devise-1.5.1 test/schema_test.rb
devise-1.5.0 test/schema_test.rb
devise-1.5.0.rc1 test/schema_test.rb
devise-1.4.9 test/schema_test.rb
devise-1.4.8 test/schema_test.rb
devise-1.4.7 test/schema_test.rb
devise-1.4.5 test/schema_test.rb
devise-1.4.3 test/schema_test.rb
devise-1.4.2 test/schema_test.rb
devise-1.4.1 test/schema_test.rb
devise-1.3.4 test/schema_test.rb
devise-1.3.3 test/schema_test.rb
devise-1.3.2 test/schema_test.rb
devise-1.3.1 test/schema_test.rb
devise-1.3.0 test/schema_test.rb