Files
astuto/spec/models/follow_spec.rb
Riccardo Graziosi dad382d2b1 Post follow and updates notifications V1 (#111)
* It is now possible to follow a post in order to receive updates about it
* Notifications are now sent when updates are published
* Post status changes are now tracked
* Update sidebar now shows the post status history
* Mark a comment as a post update using the comment form
* ... more ...
2022-05-28 11:03:36 +02:00

27 lines
511 B
Ruby

require 'rails_helper'
RSpec.describe Follow, type: :model do
let(:follow) { FactoryBot.build(:follow) }
it 'is valid' do
expect(follow).to be_valid
end
it 'must have a user_id' do
follow.user = nil
expect(follow).to be_invalid
end
it 'must have a post_id' do
follow.post = nil
expect(follow).to be_invalid
end
it 'must be unique on user and post' do
follow
f = Follow.new(user_id: follow.user_id, post_id: follow.post_id)
expect(f).to be_invalid
end
end