Sha256: f183a4bd0e5fea9529c2ba6f23d8822d65cba377052818ca57d5e4c324ef4927
Contents?: true
Size: 1.2 KB
Versions: 7
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true shared_examples "accessing the participatory space" do it "shows the page" do expect(page).to have_content("View public page") expect(page).to have_content("My space") end end shared_examples "showing the unauthorized error message" do it "redirects to the relevant unauthorized page" do expect(page).to have_content("You are not authorized to perform this action") expect(page).to have_current_path("/admin/") end end shared_examples "admin participatory space access" do before do switch_to_host(organization.host) login_as user, scope: :user end context "when the user is a normal user" do let(:user) { create(:user, :confirmed, organization: organization) } let(:unauthorized_path) { "/" } it_behaves_like "a 404 page" end context "when the user has the role" do let(:user) { role } context "and has permission" do before do visit target_path end it_behaves_like "accessing the participatory space" end context "and does not have permission" do before do visit unauthorized_target_path end it_behaves_like "showing the unauthorized error message" end end end
Version data entries
7 entries across 7 versions & 1 rubygems