-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add private user private process spec
- Loading branch information
1 parent
203cd8f
commit a7f3fa1
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Private Participatory Processes", type: :system do | ||
let!(:organization) { create(:organization) } | ||
let!(:participatory_process) { create :participatory_process, :published, organization: organization } | ||
let!(:private_participatory_process) { create :participatory_process, :published, organization: organization, private_space: true } | ||
let!(:private_user) { create :user, :confirmed, organization: organization } | ||
let!(:participatory_space_private_user) { create :participatory_space_private_user, user: private_user, privatable_to: private_participatory_process } | ||
|
||
context "when user is logged in and is a \"private participatory space\" -user and also a private user" do | ||
before do | ||
switch_to_host(organization.host) | ||
login_as private_user, scope: :user | ||
visit decidim_participatory_processes.participatory_processes_path | ||
end | ||
|
||
it "lists private participatory processes" do | ||
within "#processes-grid" do | ||
within "#processes-grid h3" do | ||
expect(page).to have_content("2") | ||
end | ||
|
||
expect(page).to have_content(translated(participatory_process.title, locale: :en)) | ||
expect(page).to have_content(translated(private_participatory_process.title, locale: :en)) | ||
expect(page).to have_selector(".card", count: 2) | ||
end | ||
end | ||
|
||
it "links to the individual process page" do | ||
first(".card__link", text: translated(private_participatory_process.title, locale: :en)).click | ||
|
||
expect(page).to have_current_path decidim_participatory_processes.participatory_process_path(private_participatory_process) | ||
expect(page).to have_content "This is a private process" | ||
end | ||
end | ||
end |