diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-05 03:31:45 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-05 03:31:45 +0200 |
commit | ccb6a658fd1a2e596c95d5b8e7a39f72a5f5b14b (patch) | |
tree | 7b846b51e3c91fb93aa379361dfe7a811bf5a01c /spec/models/follow_spec.rb | |
parent | 94d00f278819d34ef97d59d17eb289e9be217dfe (diff) | |
parent | 667ffafef8c8b7956cdd31b8f65d5e82778211d8 (diff) |
Merge branch 'fakenine-add_more_tests_to_models'
Diffstat (limited to 'spec/models/follow_spec.rb')
-rw-r--r-- | spec/models/follow_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index eb21f3e18..0fae25352 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -5,4 +5,23 @@ RSpec.describe Follow, type: :model do let(:bob) { Fabricate(:account, username: 'bob') } subject { Follow.new(account: alice, target_account: bob) } + + describe 'validations' do + it 'has a valid fabricator' do + follow = Fabricate.build(:follow) + expect(follow).to be_valid + end + + it 'is invalid without an account' do + follow = Fabricate.build(:follow, account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:account) + end + + it 'is invalid without a target_account' do + follow = Fabricate.build(:follow, target_account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:target_account) + end + end end |