Sha256: 8bbb8b8c7c0c2a45b1b3e2cad691111bf0fa79f5e2ae6cf02f86b92e310ad5af

Contents?: true

Size: 1.18 KB

Versions: 24

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class ConfirmableUserTest < ActiveSupport::TestCase
  describe ConfirmableUser do
    describe 'creation' do
      test 'email should be saved' do
        @resource = create(:confirmable_user)
        assert @resource.email.present?
      end
    end

    describe 'updating email' do
      test 'new email should be saved to unconfirmed_email' do
        @resource = create(:confirmable_user, email: 'old_address@example.com')
        @resource.update(email: 'new_address@example.com')
        assert @resource.unconfirmed_email == 'new_address@example.com'
      end

      test 'old email should be kept in email' do
        @resource = create(:confirmable_user, email: 'old_address@example.com')
        @resource.update(email: 'new_address@example.com')
        assert @resource.email == 'old_address@example.com'
      end

      test 'confirmation_token should be changed' do
        @resource = create(:confirmable_user, email: 'old_address@example.com')
        old_token = @resource.confirmation_token
        @resource.update(email: 'new_address@example.com')
        assert @resource.confirmation_token != old_token
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 6 rubygems

Version Path
devise_jwt_auth722-0.1.7 test/models/confirmable_user_test.rb
devise_jwt_auth7-0.1.7 test/models/confirmable_user_test.rb
devise_token_auth-1.2.4 test/models/confirmable_user_test.rb
devise_token_auth-1.2.2 test/models/confirmable_user_test.rb
devise_jwt_auth-0.4.1 test/models/confirmable_user_test.rb
devise_jwt_auth-0.4.0 test/models/confirmable_user_test.rb
devise_jwt_auth-0.3.0 test/models/confirmable_user_test.rb
devise_token_auth-1.2.1 test/models/confirmable_user_test.rb
devise_jwt_auth-0.2.0 test/models/confirmable_user_test.rb
devise_token_auth-1.2.0 test/models/confirmable_user_test.rb
devise_token_auth-1.1.5 test/models/confirmable_user_test.rb
sidecar_token_auth-1.0.1 test/models/confirmable_user_test.rb
devise_jwt_auth-0.1.7 test/models/confirmable_user_test.rb
devise_jwt_auth-0.1.6 test/models/confirmable_user_test.rb
devise_token_auth-1.1.4 test/models/confirmable_user_test.rb
devise_token_auth_multitenancy-1.1.3.2 test/models/confirmable_user_test.rb
devise_token_auth_multitenancy-1.1.3.1 test/models/confirmable_user_test.rb
devise_token_auth_multitenancy-1.1.3.alpha1 test/models/confirmable_user_test.rb
devise_jwt_auth-0.1.5 test/models/confirmable_user_test.rb
devise_jwt_auth-0.1.4 test/models/confirmable_user_test.rb