Enable track requests

This commit is contained in:
AEtherC0r3 2017-07-12 16:35:09 +03:00 committed by Stella Rouzi
parent 0f154d07c9
commit 2f9eb04219
14 changed files with 155 additions and 20 deletions

View file

@ -64,29 +64,51 @@ feature 'Has correct abilities' do
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Both event and booth exists
# Event and booth cfps exist
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
# Event, booth, track cfps exist
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
# Booth and track cfps exist
conference.program.cfp.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
# Only booth exists
cft.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
# No cfp exists
cfb.destroy
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Only Tracks cfp exists
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, cft)
expect(current_path).to eq edit_admin_conference_program_cfp_path(conference.short_title, cft)
# Event and track cfps exist
create(:cfp, cfp_type: 'events', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
cft.destroy!
create(:event, program: conference.program)
visit edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first)
expect(current_path).to eq(edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first))

View file

@ -106,29 +106,51 @@ feature 'Has correct abilities' do
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Both event and booth exists
# Event and booth cfps exist
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
# Event, booth, track cfps exist
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
# Booth and track cfps exist
conference.program.cfp.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
# Only booth exists
cft.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
# No cfp exists
cfb.destroy
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Only Tracks cfp exists
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, cft)
expect(current_path).to eq edit_admin_conference_program_cfp_path(conference.short_title, cft)
# Event and track cfps exist
create(:cfp, cfp_type: 'events', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
cft.destroy!
visit admin_conference_program_events_path(conference.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference.short_title))

View file

@ -112,29 +112,51 @@ feature 'Has correct abilities' do
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Both event and booth exists
# Event and booth cfps exist
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
# Event, booth, track cfps exist
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq root_path
# Booth and track cfps exist
conference.program.cfp.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
# Only booth exists
cft.destroy!
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
# No cfp exists
cfb.destroy
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
# Only Tracks cfp exists
cft = create(:cfp, cfp_type: 'tracks', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
visit edit_admin_conference_program_cfp_path(conference.short_title, cft)
expect(current_path).to eq edit_admin_conference_program_cfp_path(conference.short_title, cft)
# Event and track cfps exist
create(:cfp, cfp_type: 'events', program: conference.program)
visit new_admin_conference_program_cfp_path(conference.short_title)
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
cft.destroy!
visit admin_conference_program_events_path(conference.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference.short_title))

View file

@ -253,28 +253,34 @@ describe Program do
end
describe '#remaining_cfp_types' do
it 'returns an array with the types for which a cfp doesn\'t exist, when only the Event type does' do
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
it 'returns an array without the \'events\' type, when the cfp for events exists' do
create(:cfp, cfp_type: 'events', program: program)
expect(program.remaining_cfp_types).to eq(['booths'])
expect(program.remaining_cfp_types).to be_a Array
expect(program.remaining_cfp_types.include?('events')).to eq false
end
it 'returns an array with the types for which a cfp doesn\'t exist, when only the Booth type does' do
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
it 'returns an array without the \'booths\' type, when the cfp for booths exists' do
create(:cfp, cfp_type: 'booths', program: program)
expect(program.remaining_cfp_types).to eq(['events'])
expect(program.remaining_cfp_types).to be_a Array
expect(program.remaining_cfp_types.include?('booths')).to eq false
end
it 'returns an empty array when all the cfp types exist' do
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
it 'returns an array without the \'tracks\' type, when the cfp for tracks exists' do
create(:cfp, cfp_type: 'tracks', program: program)
expect(program.remaining_cfp_types).to be_a Array
expect(program.remaining_cfp_types.include?('tracks')).to eq false
end
it 'returns an empty array when cfps for all the types exist' do
create(:cfp, cfp_type: 'events', program: program)
create(:cfp, cfp_type: 'booths', program: program)
create(:cfp, cfp_type: 'tracks', program: program)
expect(program.remaining_cfp_types).to eq([])
end
it 'returns all the possible cfp types when there is no existed cfp type' do
it 'returns all the possible cfp types when there is no cfp' do
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
expect(program.remaining_cfp_types). to eq(%w[events booths])
expect(program.remaining_cfp_types). to eq(%w[events booths tracks])
end
end
end