osem-fcy/spec/features/track_organizer_ability_spec.rb

231 lines
12 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
feature 'Has correct abilities' do
2024-06-07 16:31:23 +02:00
let(:conference) { create(:full_conference) }
Implement track scheduling Add track association to schedule Show schedules in admin sidebar to track organizers Allow track organizers to manage the schedules of their tracks Don't allow self-organized track events to be dragged or unscheduled in a conference schedule Make scheduled events of self-organized tracks appear semitransparent in conference schedules Make the rooms of confirmed self_organized tracks appear semitransparent and don't allow events to be scheduled to it in the conference schedules during the dates of its track Create admin/SchedulesController#new action Add a button in admin/Schedules#index to create schedules for tracks Add self_organized scope to Track Modify Schedules#show to handle track schedules and show a unified schedule Allow track organizers to create new schedules for their tracks Correctly identify scheduled and unscheduled events in Schedules#events Fix Event#room and Event#time for when the event is scheduled in a track schedule Modify Program#selected_event_schedules to include the event_schedules of selected track schedules Modify Track#revoke_role_and_cleanup to destroy the track's schedules and revert its events' state to new Add tabs for conference and track schedules in admin/Schedules#index Add button to Create/Show a tracks schedule in Tracks#index and #show Fix concurrent_events in application_helper because of changes in Program#selected_event_schedules Do not take into account cfp_active in Event#valid_track Modify EventsController#get_tracks accordingly Enforce cfp_active of track to be enabled for proposals in ProposalsController#create and #update Add support for multiple schedules per track Add selected_schedule_id to Track Load EventSchedules of selected track schedules for conference schedules in admin/SchedulesController#show Modify SchedulesController#show to take into account only the selected track schedules Create Event#selected_schedule_id and use it in Event#scheduled? and Event#time Validate that an EventSchedule for an event of a self-organized track belongs to one of the track's schedules Add 'Manage' button in Tracks#index, #show that sends you to the admin side of things Add admin/TracksController#update_selected_schedule to update the selected_schedule_id of tracks
2017-08-09 18:12:20 +03:00
let(:self_organized_track) { create(:track, :self_organized, program: conference.program, state: 'confirmed') }
let(:role_track_organizer) { Role.where(name: 'track_organizer', resource: self_organized_track).first_or_create }
let(:user_track_organizer) { create(:user, role_ids: [role_track_organizer.id]) }
context 'when user is track organizer' do
before do
sign_in user_track_organizer
end
2024-06-07 16:31:23 +02:00
scenario 'for conference attributes' do
visit admin_conference_path(conference.short_title)
expect(current_path).to eq(admin_conference_path(conference.short_title))
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit")
expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference.short_title}/commercials")
expect(page).to_not have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage")
expect(page).to_not have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings")
expect(page).to have_link('Program', href: "/admin/conferences/#{conference.short_title}/program")
expect(page).to_not have_link('Call for Papers', href: "/admin/conferences/#{conference.short_title}/program/cfps")
expect(page).to have_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events")
expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks")
expect(page).to_not have_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types")
expect(page).to_not have_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels")
Implement track scheduling Add track association to schedule Show schedules in admin sidebar to track organizers Allow track organizers to manage the schedules of their tracks Don't allow self-organized track events to be dragged or unscheduled in a conference schedule Make scheduled events of self-organized tracks appear semitransparent in conference schedules Make the rooms of confirmed self_organized tracks appear semitransparent and don't allow events to be scheduled to it in the conference schedules during the dates of its track Create admin/SchedulesController#new action Add a button in admin/Schedules#index to create schedules for tracks Add self_organized scope to Track Modify Schedules#show to handle track schedules and show a unified schedule Allow track organizers to create new schedules for their tracks Correctly identify scheduled and unscheduled events in Schedules#events Fix Event#room and Event#time for when the event is scheduled in a track schedule Modify Program#selected_event_schedules to include the event_schedules of selected track schedules Modify Track#revoke_role_and_cleanup to destroy the track's schedules and revert its events' state to new Add tabs for conference and track schedules in admin/Schedules#index Add button to Create/Show a tracks schedule in Tracks#index and #show Fix concurrent_events in application_helper because of changes in Program#selected_event_schedules Do not take into account cfp_active in Event#valid_track Modify EventsController#get_tracks accordingly Enforce cfp_active of track to be enabled for proposals in ProposalsController#create and #update Add support for multiple schedules per track Add selected_schedule_id to Track Load EventSchedules of selected track schedules for conference schedules in admin/SchedulesController#show Modify SchedulesController#show to take into account only the selected track schedules Create Event#selected_schedule_id and use it in Event#scheduled? and Event#time Validate that an EventSchedule for an event of a self-organized track belongs to one of the track's schedules Add 'Manage' button in Tracks#index, #show that sends you to the admin side of things Add admin/TracksController#update_selected_schedule to update the selected_schedule_id of tracks
2017-08-09 18:12:20 +03:00
expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules")
expect(page).to have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports")
expect(page).to_not have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations")
expect(page).to_not have_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period")
expect(page).to_not have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions")
expect(page).to_not have_text('Donations')
expect(page).to_not have_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors")
expect(page).to_not have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets")
expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles")
expect(page).to_not have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources")
expect(page).to_not have_link('New Conference', href: '/admin/conferences/new')
visit edit_admin_conference_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_contact_path(conference.short_title)
expect(current_path).to eq root_path
visit admin_conference_commercials_path(conference.short_title)
expect(current_path).to eq admin_conference_commercials_path(conference.short_title)
visit new_admin_conference_splashpage_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_splashpage_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_venue_path(conference.short_title)
expect(current_path).to eq root_path
conference.venue = create(:venue)
visit edit_admin_conference_venue_path(conference.short_title)
expect(current_path).to eq root_path
visit admin_conference_venue_rooms_path(conference.short_title)
expect(current_path).to eq root_path
create(:room, venue: conference.venue)
visit edit_admin_conference_venue_room_path(conference.short_title, conference.venue.rooms.first)
expect(current_path).to eq root_path
visit admin_conference_lodgings_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_lodging_path(conference.short_title)
expect(current_path).to eq root_path
create(:lodging, conference: conference)
visit edit_admin_conference_lodging_path(conference.short_title, conference.lodgings.first)
expect(current_path).to eq root_path
visit new_admin_conference_program_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_program_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(current_path).to eq root_path
visit admin_conference_program_events_path(conference.short_title)
expect(current_path).to eq admin_conference_program_events_path(conference.short_title)
create(:event, program: conference.program)
visit edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first)
expect(current_path).to eq root_path
self_organized_track_event = create(:event, program: conference.program, track: self_organized_track)
visit edit_admin_conference_program_event_path(conference.short_title, self_organized_track_event)
expect(current_path).to eq(edit_admin_conference_program_event_path(conference.short_title, self_organized_track_event))
visit admin_conference_program_event_types_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_program_event_type_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_program_event_type_path(conference.short_title, conference.program.event_types.first)
expect(current_path).to eq root_path
visit admin_conference_program_difficulty_levels_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_program_difficulty_level_path(conference.short_title)
expect(current_path).to eq root_path
visit edit_admin_conference_program_difficulty_level_path(conference.short_title, conference.program.difficulty_levels.first)
expect(current_path).to eq root_path
visit admin_conference_schedules_path(conference.short_title)
Implement track scheduling Add track association to schedule Show schedules in admin sidebar to track organizers Allow track organizers to manage the schedules of their tracks Don't allow self-organized track events to be dragged or unscheduled in a conference schedule Make scheduled events of self-organized tracks appear semitransparent in conference schedules Make the rooms of confirmed self_organized tracks appear semitransparent and don't allow events to be scheduled to it in the conference schedules during the dates of its track Create admin/SchedulesController#new action Add a button in admin/Schedules#index to create schedules for tracks Add self_organized scope to Track Modify Schedules#show to handle track schedules and show a unified schedule Allow track organizers to create new schedules for their tracks Correctly identify scheduled and unscheduled events in Schedules#events Fix Event#room and Event#time for when the event is scheduled in a track schedule Modify Program#selected_event_schedules to include the event_schedules of selected track schedules Modify Track#revoke_role_and_cleanup to destroy the track's schedules and revert its events' state to new Add tabs for conference and track schedules in admin/Schedules#index Add button to Create/Show a tracks schedule in Tracks#index and #show Fix concurrent_events in application_helper because of changes in Program#selected_event_schedules Do not take into account cfp_active in Event#valid_track Modify EventsController#get_tracks accordingly Enforce cfp_active of track to be enabled for proposals in ProposalsController#create and #update Add support for multiple schedules per track Add selected_schedule_id to Track Load EventSchedules of selected track schedules for conference schedules in admin/SchedulesController#show Modify SchedulesController#show to take into account only the selected track schedules Create Event#selected_schedule_id and use it in Event#scheduled? and Event#time Validate that an EventSchedule for an event of a self-organized track belongs to one of the track's schedules Add 'Manage' button in Tracks#index, #show that sends you to the admin side of things Add admin/TracksController#update_selected_schedule to update the selected_schedule_id of tracks
2017-08-09 18:12:20 +03:00
expect(current_path).to eq admin_conference_schedules_path(conference.short_title)
create(:schedule, program: conference.program)
visit admin_conference_schedule_path(conference.short_title, conference.program.schedules.first)
expect(current_path).to eq root_path
Implement track scheduling Add track association to schedule Show schedules in admin sidebar to track organizers Allow track organizers to manage the schedules of their tracks Don't allow self-organized track events to be dragged or unscheduled in a conference schedule Make scheduled events of self-organized tracks appear semitransparent in conference schedules Make the rooms of confirmed self_organized tracks appear semitransparent and don't allow events to be scheduled to it in the conference schedules during the dates of its track Create admin/SchedulesController#new action Add a button in admin/Schedules#index to create schedules for tracks Add self_organized scope to Track Modify Schedules#show to handle track schedules and show a unified schedule Allow track organizers to create new schedules for their tracks Correctly identify scheduled and unscheduled events in Schedules#events Fix Event#room and Event#time for when the event is scheduled in a track schedule Modify Program#selected_event_schedules to include the event_schedules of selected track schedules Modify Track#revoke_role_and_cleanup to destroy the track's schedules and revert its events' state to new Add tabs for conference and track schedules in admin/Schedules#index Add button to Create/Show a tracks schedule in Tracks#index and #show Fix concurrent_events in application_helper because of changes in Program#selected_event_schedules Do not take into account cfp_active in Event#valid_track Modify EventsController#get_tracks accordingly Enforce cfp_active of track to be enabled for proposals in ProposalsController#create and #update Add support for multiple schedules per track Add selected_schedule_id to Track Load EventSchedules of selected track schedules for conference schedules in admin/SchedulesController#show Modify SchedulesController#show to take into account only the selected track schedules Create Event#selected_schedule_id and use it in Event#scheduled? and Event#time Validate that an EventSchedule for an event of a self-organized track belongs to one of the track's schedules Add 'Manage' button in Tracks#index, #show that sends you to the admin side of things Add admin/TracksController#update_selected_schedule to update the selected_schedule_id of tracks
2017-08-09 18:12:20 +03:00
self_organized_track_schedule = create(:schedule, program: conference.program, track: self_organized_track)
visit admin_conference_schedule_path(conference.short_title, self_organized_track_schedule)
expect(current_path).to eq admin_conference_schedule_path(conference.short_title, self_organized_track_schedule)
visit admin_conference_program_reports_path(conference.short_title)
expect(current_path).to eq admin_conference_program_reports_path(conference.short_title)
visit admin_conference_registrations_path(conference.short_title)
expect(current_path).to eq admin_conference_registrations_path(conference.short_title)
create(:registration, user: create(:user), conference: conference)
visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)
expect(current_path).to eq root_path
visit new_admin_conference_registration_period_path(conference.short_title)
expect(current_path).to eq root_path
create(:registration_period, conference: conference)
visit edit_admin_conference_registration_period_path(conference.short_title)
expect(current_path).to eq root_path
visit admin_conference_questions_path(conference.short_title)
expect(current_path).to eq root_path
visit admin_conference_sponsorship_levels_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_sponsorship_level_path(conference.short_title)
expect(current_path).to eq root_path
create(:sponsorship_level, conference: conference)
visit edit_admin_conference_sponsorship_level_path(conference.short_title, conference.sponsorship_levels.first)
expect(current_path).to eq root_path
visit admin_conference_sponsors_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_sponsor_path(conference.short_title)
expect(current_path).to eq root_path
create(:sponsor, conference: conference, sponsorship_level: conference.sponsorship_levels.first)
visit edit_admin_conference_sponsor_path(conference.short_title, conference.sponsors.first)
expect(current_path).to eq root_path
visit admin_conference_tickets_path(conference.short_title)
expect(current_path).to eq root_path
visit new_admin_conference_ticket_path(conference.short_title)
expect(current_path).to eq root_path
create(:ticket, conference: conference)
visit edit_admin_conference_ticket_path(conference.short_title, conference.tickets.first)
expect(current_path).to eq root_path
visit admin_conference_program_tracks_path(conference.short_title)
expect(current_path).to eq admin_conference_program_tracks_path(conference.short_title)
visit new_admin_conference_program_track_path(conference.short_title)
expect(current_path).to eq root_path
other_track = create(:track, program: conference.program)
visit admin_conference_program_track_path(conference.short_title, other_track)
expect(current_path).to eq root_path
visit edit_admin_conference_program_track_path(conference.short_title, other_track)
expect(current_path).to eq root_path
visit admin_conference_program_track_path(conference.short_title, self_organized_track)
expect(current_path).to eq admin_conference_program_track_path(conference.short_title, self_organized_track)
visit edit_admin_conference_program_track_path(conference.short_title, self_organized_track)
expect(current_path).to eq root_path
visit admin_conference_roles_path(conference.short_title)
expect(current_path).to eq admin_conference_roles_path(conference.short_title)
visit admin_conference_emails_path(conference.short_title)
expect(current_path).to eq root_path
visit admin_conference_resources_path(conference.short_title)
expect(current_path).to eq admin_conference_resources_path(conference.short_title)
visit new_admin_conference_resource_path(conference.short_title)
expect(current_path).to eq new_admin_conference_resource_path(conference.short_title)
create(:resource, conference: conference)
visit edit_admin_conference_resource_path(conference.short_title, conference.resources.first)
expect(current_path).to eq root_path
visit admin_revision_history_path
expect(current_path).to eq root_path
end
end
end