Sha256: 79cac5858ebb44c1c935c9eb625ec36073dbc683a4908f206bd2fcea89e70c95

Contents?: true

Size: 791 Bytes

Versions: 17

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

if DEVISE_TOKEN_AUTH_ORM == :mongoid
  class DeviseTokenAuth::Concerns::MongoidSupportTest < ActiveSupport::TestCase
    describe DeviseTokenAuth::Concerns::MongoidSupport do
      before do
        @user = create(:user)
      end

      describe '#as_json' do
        test 'should be defined' do
          assert @user.methods.include?(:as_json)
        end

        test 'should except _id attribute' do
          refute @user.as_json.key?('_id')
        end

        test 'should return with id attribute' do
          assert_equal @user._id.to_s, @user.as_json['id']
        end

        test 'should accept options' do
          refute @user.as_json(except: [:created_at]).key?('created_at')
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
devise_token_auth-1.2.4 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.2.2 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.2.1 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.2.0 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.5 test/models/concerns/mongoid_support_test.rb
sidecar_token_auth-1.0.1 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.4 test/models/concerns/mongoid_support_test.rb
devise_token_auth_multitenancy-1.1.3.2 test/models/concerns/mongoid_support_test.rb
devise_token_auth_multitenancy-1.1.3.1 test/models/concerns/mongoid_support_test.rb
devise_token_auth_multitenancy-1.1.3.alpha1 test/models/concerns/mongoid_support_test.rb
devise-tokens-1.0.4 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.3 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.2 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.1 test/models/concerns/mongoid_support_test.rb
devise_token_auth-1.1.0 test/models/concerns/mongoid_support_test.rb
devise_token_auth_fork_dfabarbosa-1.0.0 test/models/concerns/mongoid_support_test.rb
devise_token_auth_skycocker_fork-1.0.0 test/models/concerns/mongoid_support_test.rb