docbrown/spec/system/articles/moderator_moderates_an_article.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

37 lines
1.4 KiB
Ruby

require "rails_helper"
RSpec.describe "Views an article", type: :system do
let_it_be(:user) { create(:user) }
let_it_be(:moderator) { create(:user, :trusted) }
let_it_be(:article, reload: true) { create(:article, :with_notification_subscription, user: user) }
let(:timestamp) { "2019-03-04T10:00:00Z" }
before do
sign_in moderator
visit "/#{user.username}/#{article.slug}/mod"
end
it "shows an article", js: true do
visit "/#{user.username}/#{article.slug}"
expect(page).to have_content(article.title)
end
it "lets moderators visit /mod", js: true do
visit "/#{user.username}/#{article.slug}/mod"
expect(page).to have_content("Moderate: #{article.title}")
expect(page).to have_selector('button[data-category="thumbsdown"][data-reactable-type="Article"]')
expect(page).to have_selector('button[data-category="vomit"][data-reactable-type="Article"]')
expect(page).to have_selector('button[data-category="vomit"][data-reactable-type="User"]')
expect(page).to have_selector("button.level-rating-button")
end
it "shows hidden comments on /mod" do
commentor = create(:user)
create(:comment, commentable: article, user: commentor, hidden_by_commentable_user: true)
visit "/#{user.username}/#{article.slug}/mod"
expect(page).to have_content("Hidden Comments")
expect(page).to have_selector("ul#hidden-comments")
end
end