mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 00:33:36 +02:00
parent
ae64c7cbed
commit
3162c76bbf
2 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
class Account < ActiveRecord::Base
|
||||
include Versions
|
||||
belongs_to :registrar
|
||||
|
||||
belongs_to :registrar, required: true
|
||||
has_many :account_activities
|
||||
|
||||
validates :account_type, presence: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Account do
|
||||
RSpec.describe Account do
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@account = Account.new
|
||||
|
@ -45,4 +45,14 @@ describe Account do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'registrar validation', db: false do
|
||||
subject(:account) { described_class.new }
|
||||
|
||||
it 'rejects absent' do
|
||||
account.registrar = nil
|
||||
account.validate
|
||||
expect(account.errors).to have_key(:registrar)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue