mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Add ISO 8601 validations
This commit is contained in:
parent
b5bf21b127
commit
2ac59e68ff
10 changed files with 104 additions and 4 deletions
23
spec/models/keyrelay_spec.rb
Normal file
23
spec/models/keyrelay_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Keyrelay do
|
||||
it { should belong_to(:domain) }
|
||||
it { should belong_to(:requester) }
|
||||
it { should belong_to(:accepter) }
|
||||
|
||||
it 'is in pending status' do
|
||||
kr = Fabricate(:keyrelay)
|
||||
expect(kr.status).to eq('pending')
|
||||
end
|
||||
|
||||
it 'is in expired status' do
|
||||
kr = Fabricate(:keyrelay, pa_date: DateTime.now - 2.weeks)
|
||||
expect(kr.status).to eq('expired')
|
||||
end
|
||||
|
||||
it 'does not accept invalid relative expiry' do
|
||||
kr = Fabricate.build(:keyrelay, expiry_relative: 'adf')
|
||||
expect(kr.save).to eq(false)
|
||||
expect(kr.errors[:expiry_relative].first).to eq('Expiry relative must be compatible to ISO 8601')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue