2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-05-15 13:20:17 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
feature Track do
|
2014-08-12 15:48:29 +03:00
|
|
|
let!(:conference) { create(:conference) }
|
2019-03-13 10:31:42 +01:00
|
|
|
let!(:organizer) { create(:organizer, resource: conference) }
|
2017-08-17 13:36:46 +03:00
|
|
|
let(:user) { create(:user) }
|
2014-05-15 13:20:17 +02:00
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
describe 'organizer' do
|
2014-11-25 10:47:18 +01:00
|
|
|
scenario 'adds a track', feature: true, js: true do
|
2014-08-12 15:48:29 +03:00
|
|
|
|
|
|
|
|
sign_in organizer
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
expect do
|
2017-08-17 13:36:46 +03:00
|
|
|
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
|
|
|
|
click_link 'New Track'
|
2014-11-25 10:47:18 +01:00
|
|
|
|
2017-08-17 13:36:46 +03:00
|
|
|
fill_in 'track_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_short_name', with: 'Distribution'
|
|
|
|
|
click_button 'Create Track'
|
2025-08-06 13:23:29 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Track successfully created.') }
|
|
|
|
|
end.to change { Track.count }.by 1
|
2014-11-25 10:47:18 +01:00
|
|
|
|
|
|
|
|
within('table#tracks') do
|
|
|
|
|
expect(page.has_content?('Distribution')).to be true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'deletes a track', feature: true, js: true do
|
2015-10-25 13:29:02 +02:00
|
|
|
track = create(:track, program_id: conference.program.id)
|
2014-11-25 10:47:18 +01:00
|
|
|
sign_in organizer
|
|
|
|
|
|
2018-10-25 16:16:56 -07:00
|
|
|
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
|
|
|
|
within('#tracks', visible: true) do
|
|
|
|
|
click_link 'Delete'
|
2017-08-17 13:36:46 +03:00
|
|
|
end
|
2018-10-25 16:16:56 -07:00
|
|
|
page.accept_alert
|
2025-08-06 13:04:53 +02:00
|
|
|
|
|
|
|
|
within('#flash') { expect(page).to have_text('Track successfully deleted.') }
|
2017-08-28 21:55:31 +05:30
|
|
|
expect(page.has_css?('table#tracks')).to be false
|
|
|
|
|
expect(page.has_content?(track.name)).to be false
|
2018-10-25 16:16:56 -07:00
|
|
|
expect(Track.count).to eq(0)
|
2014-11-25 10:47:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'updates a track', feature: true, js: true do
|
2015-10-25 13:29:02 +02:00
|
|
|
create(:track, program_id: conference.program.id)
|
2014-11-25 10:47:18 +01:00
|
|
|
sign_in organizer
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
expect do
|
2017-08-17 13:36:46 +03:00
|
|
|
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
2017-10-10 20:23:54 -07:00
|
|
|
within('#tracks', visible: true) do
|
2018-10-25 16:16:56 -07:00
|
|
|
click_link 'Edit'
|
2017-10-10 20:23:54 -07:00
|
|
|
end
|
2014-11-25 10:47:18 +01:00
|
|
|
|
2017-08-17 13:36:46 +03:00
|
|
|
fill_in 'track_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_short_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_description', with: 'Events about our Linux distribution'
|
|
|
|
|
click_button 'Update Track'
|
2025-08-06 13:23:29 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Track successfully updated.') }
|
|
|
|
|
end.to_not(change { Track.count })
|
2025-08-06 13:04:53 +02:00
|
|
|
|
2014-11-25 10:47:18 +01:00
|
|
|
within('table#tracks') do
|
|
|
|
|
expect(page.has_content?('Distribution')).to be true
|
|
|
|
|
expect(page.has_content?('Events about our Linux')).to be true
|
2017-08-17 13:36:46 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
describe 'signed in user' do
|
|
|
|
|
before :each do
|
|
|
|
|
create(:cfp, cfp_type: 'tracks', program: conference.program)
|
|
|
|
|
end
|
|
|
|
|
|
2017-08-17 13:36:46 +03:00
|
|
|
scenario 'adds a track', feature: true, js: true do
|
|
|
|
|
|
|
|
|
|
sign_in user
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
expect do
|
2017-08-17 13:36:46 +03:00
|
|
|
visit conference_program_tracks_path(conference_id: conference.short_title)
|
|
|
|
|
click_link 'New Track request'
|
|
|
|
|
|
|
|
|
|
fill_in 'track_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_short_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_description', with: 'Events about our Linux distribution'
|
|
|
|
|
fill_in 'track_relevance', with: 'Maintainer of super awesome distribution'
|
|
|
|
|
click_button 'Create Track'
|
2025-08-06 13:23:29 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Track request successfully created.') }
|
|
|
|
|
end.to change { Track.count }.by 1
|
2017-08-17 13:36:46 +03:00
|
|
|
|
|
|
|
|
within('table#tracks') do
|
2022-03-30 12:39:01 +02:00
|
|
|
expect(page.has_content?('Distribution')).to be true
|
|
|
|
|
expect(page.has_content?('Events about our Linux dist...')).to be true
|
2017-08-17 13:36:46 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'withdraws a track', feature: true, js: true do
|
|
|
|
|
track = create(:track, :self_organized, program_id: conference.program.id, submitter: user)
|
|
|
|
|
sign_in user
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
expect do
|
2017-08-17 13:36:46 +03:00
|
|
|
visit conference_program_tracks_path(conference_id: conference.short_title)
|
|
|
|
|
|
|
|
|
|
accept_confirm do
|
|
|
|
|
click_link 'Withdraw'
|
|
|
|
|
end
|
2025-08-06 13:23:29 +02:00
|
|
|
within('#flash') { expect(page).to have_text("Track #{track.name} withdrawn.") }
|
|
|
|
|
end.to_not(change { Track.count })
|
2017-08-17 13:36:46 +03:00
|
|
|
|
|
|
|
|
within('table#tracks') do
|
2022-03-30 12:39:01 +02:00
|
|
|
expect(page.has_content?(track.name)).to be true
|
|
|
|
|
expect(page.has_link?('Re-Submit')).to be true
|
2017-08-17 13:36:46 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'updates a track', feature: true, js: true do
|
|
|
|
|
create(:track, :self_organized, program_id: conference.program.id, submitter: user)
|
|
|
|
|
sign_in user
|
|
|
|
|
|
2025-08-06 13:23:29 +02:00
|
|
|
expect do
|
2017-08-17 13:36:46 +03:00
|
|
|
visit conference_program_tracks_path(conference_id: conference.short_title)
|
|
|
|
|
click_link 'Edit'
|
|
|
|
|
|
|
|
|
|
fill_in 'track_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_short_name', with: 'Distribution'
|
|
|
|
|
fill_in 'track_description', with: 'Events about our Linux distribution'
|
|
|
|
|
click_button 'Update Track'
|
2025-08-06 13:23:29 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Track request successfully updated.') }
|
|
|
|
|
end.to_not(change { Track.count })
|
2017-08-17 13:36:46 +03:00
|
|
|
|
|
|
|
|
within('table#tracks') do
|
2022-03-30 12:39:01 +02:00
|
|
|
expect(page.has_content?('Distribution')).to be true
|
|
|
|
|
expect(page.has_content?('Events about our Linux dist...')).to be true
|
2014-11-25 10:47:18 +01:00
|
|
|
end
|
2014-05-15 13:20:17 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|