# frozen_string_literal: true
require 'rails_helper'
describe "posts/_single markdown body" do
subject(:rendered_post) do
render partial: "posts/single", locals: { post: }
rendered
end
let(:post) { create(:post, body:) }
before { controller.stub(:current_user) { nil } }
context "with bold text" do
let(:body) { "This is **strong** text" }
it { is_expected.to include "strong" }
end
context "with a photo placed in the text" do
let(:photo) { create(:photo) }
let(:body) { "Look\n\n\n\nNice" }
it { is_expected.to include %(
#{crop.name}) }
end
context "with an @mention of a member" do
let(:member) { create(:member) }
let(:body) { "Thanks @#{member.login_name}" }
it { is_expected.to include %(@#{member.login_name}) }
end
context "with raw html" do
let(:body) { 'hello' }
it { is_expected.not_to include "" }
end
context "with a raw html link" do
let(:body) { 'EVIL' }
it { is_expected.not_to include "evil.com" }
end
end