This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2016-10-09 14:48:43 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe DomainBlock, type: :model do
|
2017-04-05 00:29:56 +02:00
|
|
|
describe 'validations' do
|
|
|
|
it 'has a valid fabricator' do
|
|
|
|
domain_block = Fabricate.build(:domain_block)
|
|
|
|
expect(domain_block).to be_valid
|
|
|
|
end
|
2016-11-15 23:56:03 +01:00
|
|
|
|
2017-04-05 00:29:56 +02:00
|
|
|
it 'is invalid without a domain' do
|
|
|
|
domain_block = Fabricate.build(:domain_block, domain: nil)
|
|
|
|
domain_block.valid?
|
|
|
|
expect(domain_block).to model_have_error_on_field(:domain)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is invalid if the domain already exists' do
|
|
|
|
domain_block_1 = Fabricate(:domain_block, domain: 'dalek.com')
|
|
|
|
domain_block_2 = Fabricate.build(:domain_block, domain: 'dalek.com')
|
|
|
|
domain_block_2.valid?
|
|
|
|
expect(domain_block_2).to model_have_error_on_field(:domain)
|
|
|
|
end
|
|
|
|
end
|
2016-10-09 14:48:43 +02:00
|
|
|
end
|