blob: 8e26f68c09bc3759c51dfb7f1838e76bfa72686b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe UserCanonicalEmail do
it { is_expected.to belong_to(:user) }
describe 'validations' do
describe 'canonical_email' do
it { is_expected.to validate_presence_of(:canonical_email) }
it 'validates email address', :aggregate_failures do
expect(build(:user_canonical_email, canonical_email: 'nonsense')).not_to be_valid
expect(build(:user_canonical_email, canonical_email: '@nonsense')).not_to be_valid
expect(build(:user_canonical_email, canonical_email: '@nonsense@')).not_to be_valid
expect(build(:user_canonical_email, canonical_email: 'nonsense@')).not_to be_valid
end
end
end
end
|