mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +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
|
@ -1,24 +1,9 @@
|
|||
require 'rails_helper'
|
||||
require 'cancan/matchers'
|
||||
|
||||
describe AdminUser do
|
||||
RSpec.describe AdminUser do
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@admin_user = AdminUser.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"
|
||||
])
|
||||
before do
|
||||
@admin_user = described_class.new
|
||||
end
|
||||
|
||||
it 'should not have any versions' do
|
||||
|
@ -27,21 +12,10 @@ describe AdminUser do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before do
|
||||
@admin_user = Fabricate(:admin_user)
|
||||
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
|
||||
with_versioning do
|
||||
@admin_user.versions.should == []
|
||||
|
@ -61,4 +35,10 @@ describe AdminUser do
|
|||
])
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue