diff options
author | Samy KACIMI <samy.kacimi@gmail.com> | 2017-04-05 00:29:56 +0200 |
---|---|---|
committer | Samy KACIMI <samy.kacimi@gmail.com> | 2017-04-05 00:29:56 +0200 |
commit | 81c76fe375d9342e5a436db05c8e25305c650e8d (patch) | |
tree | 9d81c36f8745de3d5ab8827a82a14be369f0d23e /spec/models/mention_spec.rb | |
parent | 6fd865c0004efbf11ee87c06fea9f48af567fabe (diff) |
add more tests to models
Diffstat (limited to 'spec/models/mention_spec.rb')
-rw-r--r-- | spec/models/mention_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 5c91fda02..dbcf6a32c 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' RSpec.describe Mention, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + mention = Fabricate.build(:mention) + expect(mention).to be_valid + end + it 'is invalid without an account' do + mention = Fabricate.build(:mention, account: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:account) + end + + it 'is invalid without a status' do + mention = Fabricate.build(:mention, status: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:status) + end + end end |