Skip to content

Commit

Permalink
Fix system spec for My Stuff view
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 17, 2024
1 parent 7f0ab1d commit 69358e1
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions spec/system/visit_my_stuff_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "rails_helper"

RSpec.describe "Visit the My Stuff page" do
RSpec.describe "Visit the My Stuff page", js: true do
let(:steward) { users(:third_user) }
let(:admin) { users(:admin_user) }
let(:organization_1) { organizations(:hardrock) }
Expand All @@ -15,31 +15,20 @@

scenario "The user is a non-admin user that is a steward of an organization" do
login_as steward, scope: :user
visit my_stuff_user_path(steward)
visit_my_stuff_path

verify_org_links_present(organization_1)
end

scenario "The user is a non-admin user that attempts to reach the my_stuff page of another user" do
login_as steward, scope: :user
visit my_stuff_user_path(admin)

expect(page).not_to have_content("My Events")
expect(page).not_to have_content("My Organizations")
end

scenario "The user is an admin user signing into his own page" do
scenario "The user is an admin user" do
login_as admin, scope: :user
visit my_stuff_user_path(admin)
visit_my_stuff_path

verify_org_links_present(organization_2)
end

scenario "The user is an admin user signing into another user page" do
login_as admin, scope: :user
visit my_stuff_user_path(steward)

verify_org_links_present(organization_1)
def visit_my_stuff_path
visit my_stuff_path
end

def verify_org_links_present(organization)
Expand Down

0 comments on commit 69358e1

Please sign in to comment.