Track related refactoring
Add roles as nested routes to track (for the track organizer role) Allow transition from to_accept to to_reject and backwards Split Track#valid_dates validation to many independent ones Show all the confirmed tracks in the conference's splashpage Add comment in admin/Tracks#toggle_cfp_inclusion Rewrite admin/TracksController#accept spec Add feature spec for track requests Change 'In' to 'Room' in Tracks#index Rewrite Track#overlapping Refactor code in ProposalsController Fix typos
This commit is contained in:
parent
9c4892bfc8
commit
27fa79a826
21 changed files with 279 additions and 144 deletions
|
|
@ -4,26 +4,29 @@ feature Track do
|
|||
let!(:conference) { create(:conference) }
|
||||
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
shared_examples 'tracks' do
|
||||
shared_examples 'admin tracks' do
|
||||
scenario 'adds a track', feature: true, js: true do
|
||||
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'New Track'
|
||||
expected = expect do
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'New Track'
|
||||
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
fill_in 'track_short_name', with: 'Distribution'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Create Track'
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
fill_in 'track_short_name', with: 'Distribution'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Create Track'
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by 1
|
||||
expect(flash).to eq('Track successfully created.')
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
expect(page.has_content?('Events about our Linux')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -31,15 +34,17 @@ feature Track do
|
|||
track = create(:track, program_id: conference.program.id)
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
expected = expect do
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
|
||||
click_link 'Delete'
|
||||
click_link 'Delete'
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by(-1)
|
||||
expect(flash).to eq('Track successfully deleted.')
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?(track.name)).to be false
|
||||
expect(page.has_content?(track.description)).to be false
|
||||
expect(page.has_content?('No data available in table')).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -47,25 +52,104 @@ feature Track do
|
|||
create(:track, program_id: conference.program.id)
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'Edit'
|
||||
expected = expect do
|
||||
visit admin_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'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
fill_in 'track_short_name', with: 'Distribution'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
end
|
||||
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq('Track successfully updated.')
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
expect(page.has_content?('Events about our Linux')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'non admin tracks' do
|
||||
scenario 'adds a track', feature: true, js: true do
|
||||
|
||||
sign_in user
|
||||
|
||||
expected = expect do
|
||||
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'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
fill_in 'track_relevance', with: 'Maintainer of super awesome distribution'
|
||||
click_button 'Create Track'
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by 1
|
||||
expect(flash).to eq('Track request successfully created.')
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to eq true
|
||||
expect(page.has_content?('Events about our Linux dist...')).to eq true
|
||||
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
|
||||
|
||||
expected = expect do
|
||||
visit conference_program_tracks_path(conference_id: conference.short_title)
|
||||
|
||||
accept_confirm do
|
||||
click_link 'Withdraw'
|
||||
end
|
||||
end
|
||||
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq("Track #{track.name} withdrawn.")
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?(track.name)).to eq true
|
||||
expect(page.has_link?('Re-Submit')).to eq true
|
||||
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
|
||||
|
||||
expected = expect do
|
||||
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'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
end
|
||||
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq('Track request successfully updated.')
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to eq true
|
||||
expect(page.has_content?('Events about our Linux dist...')).to eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'organizer' do
|
||||
it_behaves_like 'tracks'
|
||||
it_behaves_like 'admin tracks'
|
||||
end
|
||||
|
||||
describe 'signed in user' do
|
||||
before :each do
|
||||
create(:cfp, cfp_type: 'tracks', program: conference.program)
|
||||
end
|
||||
|
||||
it_behaves_like 'non admin tracks'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue