docbrown/spec/system/user_visits_a_comments_page_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

24 lines
928 B
Ruby

require "rails_helper"
RSpec.describe "Views an article", type: :system, js: true do
let(:user) { create(:user) }
let(:article) { create(:article, user: user) }
let!(:comment) { create(:comment, commentable: article) }
let!(:child_comment) { create(:comment, parent: comment, commentable: article) }
it "shows all comments" do
create(:comment, commentable: article)
visit "#{article.path}/comments"
expect(page).to have_selector(".single-comment-node", visible: :visible, count: 3)
end
it "shows a thread" do
visit "#{article.path}/comments/#{comment.id_code_generated}"
expect(page).to have_selector(".single-comment-node", visible: :visible, count: 2)
expect(page).to have_selector(".comment-deep-0#comment-node-#{comment.id}", visible: :visible, count: 1)
expect(page).to have_selector(".comment-deep-1#comment-node-#{child_comment.id}", visible: :visible, count: 1)
end
end