mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
* 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 ...
27 lines
511 B
Ruby
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
|