Files
postter/spec/models/post_spec.rb
João Victor Geonizeli 1d692b31f8 add post
2022-02-27 17:02:37 -03:00

32 lines
817 B
Ruby

require 'rails_helper'
RSpec.describe Post, type: :model do
describe '#kind' do
context 'when post have other post reference and a content' do
it 'returns :quoted_post' do
quoted_post = create(:post)
post = create(:post, quoted_post: quoted_post)
expect(post.kind).to eq(:quoted_post)
end
end
context 'when post have other post reference and dont have a content' do
it 'returns :repost' do
quoted_post = create(:post)
post = create(:post, quoted_post: quoted_post, content: nil)
expect(post.kind).to eq(:repost)
end
end
context 'when post dont have other post reference and have a content' do
it 'returns :post' do
post = create(:post)
expect(post.kind).to eq(:post)
end
end
end
end