docbrown/spec/system/articles/moderator_moderates_an_article_spec.rb
dependabot[bot] 1ea169a351
Bump rubocop-rspec from 2.3.0 to 2.4.0 (#13951)
* Bump rubocop-rspec from 2.3.0 to 2.4.0

Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Enable new cops, fix violations and refactor specs

* Remove expected "Moderate" text from the /mod page test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Dan Uber <dan@forem.com>
2021-06-14 09:27:13 +02:00

36 lines
1.3 KiB
Ruby

require "rails_helper"
RSpec.describe "Views an article", type: :system do
let(:user) { create(:user) }
let(:moderator) { create(:user, :trusted) }
let(:article) { 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_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