Introduce Program to include cfp/rooms/tracks/events/event_types/difficulty_levels

This commit is contained in:
Stella Rouzi 2015-10-25 13:29:02 +02:00 committed by Henne Vogelsang
parent 028b82fda8
commit 444356fbc7
117 changed files with 1812 additions and 905 deletions

View file

@ -37,22 +37,23 @@ feature 'Has correct abilities' do
expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit")
expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/events")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule")
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns")
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/rooms")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/program/rooms")
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings")
expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels")
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors")
expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles")
@ -65,8 +66,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference1.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference1.short_title))
visit admin_conference_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_events_path(conference1.short_title))
visit admin_conference_program_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference1.short_title))
visit admin_conference_schedule_path(conference1.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference1.short_title))
@ -93,8 +94,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference1.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference1.short_title))
visit new_admin_conference_call_for_paper_path(conference1.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference1.short_title))
visit new_admin_conference_program_cfp_path(conference1.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference1.short_title))
visit admin_conference_questions_path(conference1.short_title)
expect(current_path).to eq(admin_conference_questions_path(conference1.short_title))
@ -113,22 +114,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/events")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/program/events")
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/rooms")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/program/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/program/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles")
@ -141,8 +143,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference2.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference2.short_title))
visit admin_conference_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_events_path(conference2.short_title))
visit admin_conference_program_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference2.short_title))
visit admin_conference_schedule_path(conference2.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference2.short_title))
@ -165,8 +167,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference2.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference2.short_title))
visit new_admin_conference_call_for_paper_path(conference2.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference2.short_title))
visit new_admin_conference_program_cfp_path(conference2.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference2.short_title))
visit admin_conference_questions_path(conference2.short_title)
expect(current_path).to eq(root_path)
@ -185,22 +187,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/events")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations")
expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference3.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets")
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/rooms")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/program/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels")
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/call_for_paper")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/difficulty_levels")
expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/program/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles")
@ -213,7 +216,7 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference3.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference3.short_title))
visit admin_conference_events_path(conference3.short_title)
visit admin_conference_program_events_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit admin_conference_schedule_path(conference3.short_title)
@ -237,7 +240,7 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit new_admin_conference_call_for_paper_path(conference3.short_title)
visit new_admin_conference_program_cfp_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit admin_conference_questions_path(conference3.short_title)

View file

@ -8,13 +8,13 @@ feature Conference do
shared_examples 'add and update cfp' do
scenario 'adds a new cfp', feature: true, js: true do
expected_count = CallForPaper.count + 1
expected_count = Cfp.count + 1
sign_in organizer
visit new_admin_conference_call_for_paper_path(conference.short_title)
visit new_admin_conference_program_cfp_path(conference.short_title)
click_button 'Create Call for paper'
click_button 'Create Cfp'
expect(flash).
to eq('Creating the call for papers failed. ' +
@ -26,32 +26,29 @@ feature Conference do
page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '4'
click_button 'Create Call for paper'
click_button 'Create Cfp'
# Validations
expect(flash).
to eq('Call for papers successfully created.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('4')
expect(CallForPaper.count).to eq(expected_count)
expect(Cfp.count).to eq(expected_count)
end
scenario 'update cfp', feature: true, js: true do
conference.call_for_paper = create(:call_for_paper)
expected_count = CallForPaper.count
conference.program.cfp = create(:cfp)
expected_count = Cfp.count
sign_in organizer
visit admin_conference_call_for_paper_path(conference.short_title)
visit admin_conference_program_cfp_path(conference.short_title)
click_link 'Edit'
# Validate update with empty start date will not saved
page.execute_script(
"$('#conference-start-datepicker').val('')")
click_button 'Update Call for paper'
click_button 'Update Cfp'
expect(flash).
to eq('Updating call for papers failed. ' +
"Start date can't be blank.")
@ -63,16 +60,14 @@ feature Conference do
page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '0'
click_button 'Update Call for paper'
click_button 'Update Cfp'
# Validations
expect(flash).
to eq('Call for papers successfully updated.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('0')
expect(CallForPaper.count).to eq(expected_count)
expect(Cfp.count).to eq(expected_count)
end
end

View file

@ -42,7 +42,7 @@ feature Commercial do
end
context 'in public area' do
let!(:event) { create(:event, conference: conference, title: 'Example Proposal') }
let!(:event) { create(:event, program: conference.program, title: 'Example Proposal') }
before(:each) do
event.event_users = [create(:event_user,
@ -58,8 +58,8 @@ feature Commercial do
sign_out
end
scenario 'adds a commercial of an event', feature: true, js: true do
visit edit_conference_proposal_path(conference.short_title, event.id)
scenario 'adds a valid commercial of an event', feature: true, js: true do
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
@ -75,7 +75,7 @@ feature Commercial do
commercial = create(:commercial,
commercialable_id: event.id,
commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id)
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update'
@ -89,7 +89,7 @@ feature Commercial do
create(:commercial,
commercialable_id: event.id,
commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id)
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
click_link 'Delete'
page.driver.network_traffic

View file

@ -9,7 +9,7 @@ feature DifficultyLevel do
scenario 'adds difficulty level', feature: true, js: true do
sign_in organizer
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Add difficulty level
@ -32,9 +32,9 @@ feature DifficultyLevel do
scenario 'updates difficulty level', feature: true, js: true do
conference.difficulty_levels << create(:difficulty_level)
conference.program.difficulty_levels << create(:difficulty_level)
sign_in organizer
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Remove difficulty level

View file

@ -9,7 +9,7 @@ feature EventType do
scenario 'adds and updates event type', feature: true, js: true do
sign_in organizer
visit admin_conference_event_types_path(
visit admin_conference_program_event_types_path(
conference_id: conference.short_title)
within('table#event_types') do

View file

@ -0,0 +1,30 @@
require 'spec_helper'
feature Program do
let!(:conference) { create(:conference) }
let!(:program) { conference.program }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
describe 'edit program' do
before :each do
sign_in organizer
end
scenario 'changes rating', feature: true, js: true do
visit admin_conference_program_path(conference.short_title)
click_link 'Edit'
fill_in 'program_rating', with: '4'
click_button 'Update Program'
# Validations
expect(flash).
to eq('The program was successfully updated.')
expect(find('#rating').text).to eq('4')
end
end
end

View file

@ -1,7 +1,8 @@
require 'spec_helper'
feature Event do
let!(:conference) { create(:conference, call_for_paper: create(:call_for_paper)) }
let!(:conference) { create(:conference) }
let!(:cfp) { create(:cfp, program_id: conference.program.id) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
let!(:participant) { create(:user) }
@ -10,7 +11,7 @@ feature Event do
before(:each) do
@options = {}
@options[:send_mail] = 'false'
@event = create(:event, conference: conference, title: 'Example Proposal')
@event = create(:event, program: conference.program, title: 'Example Proposal')
end
after(:each) do
@ -23,7 +24,7 @@ feature Event do
end
scenario 'rejects a proposal', feature: true, js: true do
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'New'
@ -34,7 +35,7 @@ feature Event do
end
scenario 'accepts a proposal', feature: true, js: true do
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'New'
@ -47,7 +48,7 @@ feature Event do
scenario 'restarts review of a proposal', feature: true, js: true do
@event.reject!(@options)
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'Rejected'
@ -71,7 +72,7 @@ feature Event do
expected_count_event = Event.count + 1
expected_count_user = User.count + 1
visit new_conference_proposal_path(conference.short_title)
visit new_conference_program_proposal_path(conference.short_title)
fill_in 'user_username', with: 'Test User'
fill_in 'user_email', with: 'testuser@osem.io'
@ -90,11 +91,12 @@ feature Event do
end
scenario 'update a proposal' do
proposal = create(:event)
conference = create(:conference)
proposal = create(:event, program: conference.program)
sign_in proposal.submitter
visit edit_conference_proposal_path(proposal.conference.short_title, proposal)
visit edit_conference_program_proposal_path(proposal.program.conference.short_title, proposal)
fill_in 'event_subtitle', with: 'My event subtitle'
select('Easy', from: 'event[difficulty_level_id]')
@ -106,7 +108,7 @@ feature Event do
scenario 'signed_in user submits a valid proposal', feature: true, js: true do
sign_in participant_without_bio
expected_count = Event.count + 1
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
click_link 'New Proposal'
fill_in 'event_title', with: 'Example Proposal'
@ -120,13 +122,13 @@ feature Event do
click_button 'Create Proposal'
expect(flash).to eq('Proposal was successfully submitted.')
expect(current_path).to eq(conference_proposal_index_path(conference.short_title))
expect(current_path).to eq(conference_program_proposal_index_path(conference.short_title))
expect(Event.count).to eq(expected_count)
end
scenario 'confirms a proposal', feature: true, js: true do
sign_in participant
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
expect(@event.state).to eq('unconfirmed')
click_link "confirm_proposal_#{@event.id}"
@ -139,7 +141,7 @@ feature Event do
scenario 'withdraw a proposal', feature: true, js: true do
sign_in participant
@event.confirm!
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_link "delete_proposal_#{@event.id}"
expect(flash).to eq('Proposal was successfully withdrawn.')

View file

@ -8,7 +8,7 @@ feature Room do
shared_examples 'rooms' do
scenario 'adds a room', feature: true, js: true do
sign_in organizer
visit admin_conference_rooms_path(
visit admin_conference_program_rooms_path(
conference_id: conference.short_title)
expect(page.has_no_table?('#rooms')).to be true
@ -30,9 +30,9 @@ feature Room do
end
scenario 'updates a room', feature: true, js: true do
room = create(:room, conference_id: conference.id)
room = create(:room, program_id: conference.program.id)
sign_in organizer
visit edit_admin_conference_room_path(
visit edit_admin_conference_program_room_path(
conference_id: conference.short_title, id: room.id)
fill_in 'room_name', with: 'Auditorium'

View file

@ -10,7 +10,7 @@ feature Track do
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'New Track'
fill_in 'track_name', with: 'Distribution'
@ -27,10 +27,10 @@ feature Track do
end
scenario 'deletes a track', feature: true, js: true do
track = create(:track, conference_id: conference.id)
track = create(:track, program_id: conference.program.id)
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'Delete'
@ -43,10 +43,10 @@ feature Track do
end
scenario 'updates a track', feature: true, js: true do
create(:track, conference_id: conference.id)
create(:track, program_id: conference.program.id)
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'Edit'
fill_in 'track_name', with: 'Distribution'