docbrown/spec/system/comments/user_views_a_comment_spec.rb
Vaidehi Joshi d2ef01ecc2
Remove Percy (#8915)
We are no longer using the Percy service, so this code is not required anymore.
Removes the percy agent, the gem, and all references to Percy.snapshot and percy: true.
2020-06-25 11:19:58 -07:00

29 lines
771 B
Ruby

require "rails_helper"
RSpec.describe "Viewing a comment", type: :system, js: true do
let(:user) { create(:user) }
let(:article) { create(:article, user_id: user.id, show_comments: true) }
let(:comment) { create(:comment, commentable: article, user: user) }
let!(:timestamp) { "2019-03-04T10:00:00Z" }
before do
Timecop.freeze(timestamp)
sign_in user
visit comment.path
end
after do
Timecop.return
end
context "when showing the date" do
it "shows the readable publish date" do
expect(page).to have_selector(".comment-date time", text: "Mar 4")
end
it "embeds the published timestamp" do
selector = ".comment-date time[datetime='#{timestamp}']"
expect(page).to have_selector(selector)
end
end
end