Sha256: 4176366b93b976bbad9d181e58166a12a3e1f0a17f5ef022bf05fe17c371191f
Contents?: true
Size: 1.69 KB
Versions: 9
Compression:
Stored size: 1.69 KB
Contents
# -*- coding: utf-8 -*- # frozen_string_literal: true RSpec.shared_examples "reports" do context "when the user is not logged in" do it "should be given the option to sign in" do visit reportable_path expect(page).to have_selector(".author-data__extra") within ".author-data__extra", match: :first do page.find("button").click end expect(page).to have_css("#loginModal", visible: true) end end context "when the user is logged in" do before do login_as user, scope: :user end context "and the user has not reported the resource yet" do it "reports the resource" do visit reportable_path expect(page).to have_selector(".author-data__extra") within ".author-data__extra", match: :first do page.find("button").click end expect(page).to have_css(".flag-modal", visible: true) within ".flag-modal" do click_button "Report" end expect(page).to have_content "report has been created" end end context "and the user has reported the resource previously" do before do moderation = create(:moderation, reportable: reportable, participatory_process: participatory_process) create(:report, moderation: moderation, user: user, reason: "spam") end it "cannot report it twice" do visit reportable_path expect(page).to have_selector(".author-data__extra") within ".author-data__extra", match: :first do page.find("button").click end expect(page).to have_css(".flag-modal", visible: true) expect(page).to have_content "already reported" end end end end
Version data entries
9 entries across 9 versions & 1 rubygems