[deploy] fix podcast episode comment rendering and write a spec for it (#7547)

This commit is contained in:
Molly Struve 2020-04-27 14:56:03 -05:00 committed by GitHub
parent 54519dbf4e
commit 8eb4612166
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -48,7 +48,7 @@
<% end %>
<h3 id="comments-header"><%= @commentable.title %></h3>
<h4>
<%= @commentable.user.name %>
<%= @commentable.is_a?(PodcastEpisode) ? @commentable.podcast.name : @commentable.user.name %>
<span class="published-at"><%= "on " + @commentable.published_at.strftime("%B %d, %Y") if @commentable.published_at %></span>
</h4>
</a>

View file

@ -0,0 +1,17 @@
require "rails_helper"
RSpec.describe "viewing podcast comments", type: :system, js: true do
let(:user) { create(:user) }
let(:podcast) { create(:podcast, creator: user) }
let(:podcast_episode) { create(:podcast_episode, podcast: podcast) }
let(:comment) { create(:comment, commentable: podcast_episode, user: user) }
before do
sign_in user
visit "/#{podcast.slug}/#{podcast_episode.slug}/comments"
end
it "renders comment" do
expect(page).to have_content(comment.body_html)
end
end