mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
parent
ae64c7cbed
commit
3162c76bbf
2 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
class Account < ActiveRecord::Base
|
class Account < ActiveRecord::Base
|
||||||
include Versions
|
include Versions
|
||||||
belongs_to :registrar
|
|
||||||
|
belongs_to :registrar, required: true
|
||||||
has_many :account_activities
|
has_many :account_activities
|
||||||
|
|
||||||
validates :account_type, presence: true
|
validates :account_type, presence: true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Account do
|
RSpec.describe Account do
|
||||||
context 'with invalid attribute' do
|
context 'with invalid attribute' do
|
||||||
before :all do
|
before :all do
|
||||||
@account = Account.new
|
@account = Account.new
|
||||||
|
@ -45,4 +45,14 @@ describe Account do
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue