From 4667eed427aa2761f412ba75e3a56b6e528ffc75 Mon Sep 17 00:00:00 2001 From: moveson Date: Mon, 16 Dec 2024 21:47:06 -0700 Subject: [PATCH] Simplify system spec for the My Stuff page --- spec/system/visit_my_stuff_page_spec.rb | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/spec/system/visit_my_stuff_page_spec.rb b/spec/system/visit_my_stuff_page_spec.rb index 8e88b1bf6..e0486034d 100644 --- a/spec/system/visit_my_stuff_page_spec.rb +++ b/spec/system/visit_my_stuff_page_spec.rb @@ -2,39 +2,32 @@ require "rails_helper" -RSpec.describe "Visit the My Stuff page", js: true do - let(:steward) { users(:third_user) } +RSpec.describe "Visit the My Stuff page" do + let(:non_admin) { users(:third_user) } let(:admin) { users(:admin_user) } let(:organization_1) { organizations(:hardrock) } let(:organization_2) { organizations(:rattlesnake_ramble) } - before do - organization_1.stewards << steward - organization_2.stewards << admin - end - - scenario "The user is a non-admin user that is a steward of an organization" do - login_as steward, scope: :user + scenario "The user is a non-admin user" do + login_as non_admin, scope: :user visit_my_stuff_path - verify_org_links_present(organization_1) + verify_headings_present end scenario "The user is an admin user" do login_as admin, scope: :user visit_my_stuff_path - verify_org_links_present(organization_2) + verify_headings_present end def visit_my_stuff_path visit my_stuff_path end - def verify_org_links_present(organization) + def verify_headings_present expect(page).to have_content("My Events") expect(page).to have_content("My Organizations") - verify_link_present(organization) - organization.event_groups.each(&method(:verify_link_present)) end end