Skip to content

Commit 98059a4

Browse files
committed
refactor: move attendees tab spec to requests and remove old view spec
1 parent 93e162d commit 98059a4

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

spec/requests/better_together/events/attendees_tab_spec.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

spec/requests/better_together/events_controller_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,42 @@
4949
end
5050
end
5151

52+
describe 'GET /events/:id' do
53+
let(:manager_user) do
54+
BetterTogether::User.find_by(email: '[email protected]') ||
55+
create(:better_together_user, :confirmed, :platform_manager, email: '[email protected]')
56+
end
57+
58+
let(:event) do
59+
BetterTogether::Event.create!(
60+
name: 'Neighborhood Clean-up',
61+
starts_at: 1.day.from_now,
62+
identifier: SecureRandom.uuid,
63+
privacy: 'public',
64+
creator: manager_user.person
65+
)
66+
end
67+
68+
context 'as platform manager', :as_platform_manager do
69+
it 'shows attendees tab to organizers' do
70+
get better_together.event_path(event, locale:)
71+
72+
expect(response).to have_http_status(:ok)
73+
# Look for the attendees tab nav link by id to avoid matching HTML comments
74+
expect(response.body).to include('id="attendees-tab"')
75+
end
76+
end
77+
78+
context 'as regular user', :as_user do
79+
it 'does not show attendees tab to non-organizer' do
80+
get better_together.event_path(event, locale:)
81+
82+
expect(response).to have_http_status(:ok)
83+
expect(response.body).not_to include('id="attendees-tab"')
84+
end
85+
end
86+
end
87+
5288
describe 'RSVP actions' do
5389
let(:user_email) { '[email protected]' }
5490
let(:password) { 'password12345' }

spec/views/better_together/events/attendees_tab_spec.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)