mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Admin user model returns mix password length
This commit is contained in:
parent
9c8eba9ea9
commit
6071c58106
2 changed files with 14 additions and 30 deletions
|
@ -11,6 +11,10 @@ class AdminUser < User
|
||||||
|
|
||||||
devise :database_authenticatable, :rememberable, :trackable, :validatable, :lockable
|
devise :database_authenticatable, :rememberable, :trackable, :validatable, :lockable
|
||||||
|
|
||||||
|
def self.min_password_length
|
||||||
|
Devise.password_length.min
|
||||||
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
username
|
username
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,24 +1,9 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
require 'cancan/matchers'
|
|
||||||
|
|
||||||
describe AdminUser do
|
RSpec.describe AdminUser do
|
||||||
context 'with invalid attribute' do
|
context 'with invalid attribute' do
|
||||||
before :all do
|
before do
|
||||||
@admin_user = AdminUser.new
|
@admin_user = described_class.new
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not be valid' do
|
|
||||||
@admin_user.valid?
|
|
||||||
@admin_user.errors.full_messages.should match_array([
|
|
||||||
"Country code is missing",
|
|
||||||
"Email Email is missing",
|
|
||||||
"Email Email is missing",
|
|
||||||
"Password Password is missing",
|
|
||||||
"Password Password is missing",
|
|
||||||
"Password confirmation is missing",
|
|
||||||
"Roles is missing",
|
|
||||||
"Username Username is missing"
|
|
||||||
])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not have any versions' do
|
it 'should not have any versions' do
|
||||||
|
@ -27,21 +12,10 @@ describe AdminUser do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with valid attributes' do
|
context 'with valid attributes' do
|
||||||
before :all do
|
before do
|
||||||
@admin_user = Fabricate(:admin_user)
|
@admin_user = Fabricate(:admin_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be valid' do
|
|
||||||
@admin_user.valid?
|
|
||||||
@admin_user.errors.full_messages.should match_array([])
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should be valid twice' do
|
|
||||||
@admin_user = Fabricate(:admin_user)
|
|
||||||
@admin_user.valid?
|
|
||||||
@admin_user.errors.full_messages.should match_array([])
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should have one version' do
|
it 'should have one version' do
|
||||||
with_versioning do
|
with_versioning do
|
||||||
@admin_user.versions.should == []
|
@admin_user.versions.should == []
|
||||||
|
@ -61,4 +35,10 @@ describe AdminUser do
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#min_password_length' do
|
||||||
|
it 'returns minimum password length' do
|
||||||
|
expect(described_class.min_password_length).to eq(8)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue