1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/models/shared_examples/asymmetric_key.rb

52 lines
1.4 KiB
Ruby
Raw Normal View History

2019-09-13 17:45:49 -04:00
# frozen_string_literal: true
RSpec.shared_examples 'asymmetric_key' do
describe '#account' do
it { is_expected.to belong_to(:account).optional }
it { is_expected.not_to validate_presence_of :account }
it { is_expected.not_to validate_uniqueness_of :account }
end
describe '#public_key_pem' do
it { is_expected.to validate_presence_of :public_key_pem }
it { is_expected.to validate_uniqueness_of :public_key_pem }
end
describe '#public_key_der' do
it { is_expected.to validate_presence_of :public_key_der }
it { is_expected.to validate_uniqueness_of :public_key_der }
end
describe '#has_password' do
it { is_expected.to validate_exclusion_of(:has_password).in_array([nil]) }
end
describe '#bits' do
it do
is_expected.to \
validate_numericality_of(:bits)
.only_integer
.is_greater_than(0)
end
end
describe '#sha1' do
it { is_expected.to validate_presence_of :sha1 }
it { is_expected.to validate_uniqueness_of(:sha1).case_insensitive }
end
describe '#sha256' do
it { is_expected.to validate_presence_of :sha256 }
it { is_expected.to validate_uniqueness_of(:sha256).case_insensitive }
end
describe '#private_key_pem_iv' do
it { is_expected.not_to validate_presence_of :private_key_pem_iv }
end
describe '#private_key_pem_ciphertext' do
it { is_expected.not_to validate_presence_of :private_key_pem_ciphertext }
end
end