Implement consistent admin interface
* Consistent route/model/controller/view layout * Get rid of unused photos, speakers, dietchoices, social_events controllers * Drop unused :public from Rooms and :description from CallForPapers
This commit is contained in:
parent
f6a87331be
commit
28063129c7
133 changed files with 1461 additions and 1461 deletions
|
|
@ -23,7 +23,6 @@ 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('Photos', href: "/admin/conference/#{conference1.short_title}/photos")
|
||||
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/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")
|
||||
|
|
@ -36,7 +35,7 @@ feature 'Has correct abilities' do
|
|||
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}/callforpapers")
|
||||
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")
|
||||
|
|
@ -76,8 +75,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 admin_conference_callforpapers_path(conference1.short_title)
|
||||
expect(current_path).to eq(admin_conference_callforpapers_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 admin_conference_questions_path(conference1.short_title)
|
||||
expect(current_path).to eq(admin_conference_questions_path(conference1.short_title))
|
||||
|
|
@ -94,7 +93,6 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit")
|
||||
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_not have_link('Photos', href: "/admin/conference/#{conference2.short_title}/photos")
|
||||
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/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")
|
||||
|
|
@ -107,7 +105,7 @@ feature 'Has correct abilities' do
|
|||
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}/callforpapers")
|
||||
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")
|
||||
|
|
@ -147,8 +145,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 admin_conference_callforpapers_path(conference2.short_title)
|
||||
expect(current_path).to eq(admin_conference_callforpapers_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 admin_conference_questions_path(conference2.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
|
@ -165,7 +163,6 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference3.short_title}/edit")
|
||||
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('Photos', href: "/admin/conference/#{conference3.short_title}/photos")
|
||||
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/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")
|
||||
|
|
@ -178,7 +175,7 @@ feature 'Has correct abilities' do
|
|||
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}/callforpapers")
|
||||
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")
|
||||
|
|
@ -218,7 +215,7 @@ feature 'Has correct abilities' do
|
|||
visit admin_conference_emails_path(conference3.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit admin_conference_callforpapers_path(conference3.short_title)
|
||||
visit new_admin_conference_call_for_paper_path(conference3.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit admin_conference_questions_path(conference3.short_title)
|
||||
|
|
@ -237,7 +234,6 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('Basics', href: "/admin/conference/#{conference4.short_title}/edit")
|
||||
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference4.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference4.short_title}/commercials")
|
||||
expect(page).to_not have_link('Photos', href: "/admin/conference/#{conference4.short_title}/photos")
|
||||
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference4.short_title}/events")
|
||||
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference4.short_title}/registrations")
|
||||
expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference4.short_title}/schedule")
|
||||
|
|
@ -250,7 +246,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference4.short_title}/sponsors")
|
||||
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference4.short_title}/supporter_levels")
|
||||
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference4.short_title}/emails")
|
||||
expect(page).to_not have_link('Call for Papers', href: "/admin/conference/#{conference4.short_title}/callforpapers")
|
||||
expect(page).to_not have_link('Call for Papers', href: "/admin/conference/#{conference4.short_title}/call_for_paper")
|
||||
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference4.short_title}/tracks")
|
||||
expect(page).to_not have_link('Event Types', href: "/admin/conference/#{conference4.short_title}/event_types")
|
||||
expect(page).to_not have_link('Difficulty Levels', href: "/admin/conference/#{conference4.short_title}/difficulty_levels")
|
||||
|
|
@ -290,7 +286,7 @@ feature 'Has correct abilities' do
|
|||
visit admin_conference_emails_path(conference4.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit admin_conference_callforpapers_path(conference4.short_title)
|
||||
visit new_admin_conference_call_for_paper_path(conference4.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit admin_conference_questions_path(conference4.short_title)
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ feature Campaign do
|
|||
expect(flash).
|
||||
to eq('Campaign successfully created.')
|
||||
|
||||
expect(find('#name_0').text).to eq('Test Campaign')
|
||||
expect(find('#visits_0').text).to eq('0')
|
||||
expect(find('#registrations_0').text).to eq('0')
|
||||
expect(find('#submissions_0').text).to eq('0')
|
||||
expect(find('#name_1').text).to eq('Test Campaign')
|
||||
expect(find('#visits_1').text).to eq('0')
|
||||
expect(find('#registrations_1').text).to eq('0')
|
||||
expect(find('#submissions_1').text).to eq('0')
|
||||
|
||||
expect(Campaign.count).to eq(expected_count)
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = CallForPapers.count + 1
|
||||
expected_count = CallForPaper.count + 1
|
||||
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_callforpapers_path(conference.short_title)
|
||||
visit new_admin_conference_call_for_paper_path(conference.short_title)
|
||||
|
||||
click_button 'Create Call for papers'
|
||||
click_button 'Create Call for paper'
|
||||
|
||||
expect(flash).
|
||||
to eq('Creating the call for papers failed. ' +
|
||||
|
|
@ -26,36 +26,32 @@ feature Conference do
|
|||
page.execute_script(
|
||||
"$('#conference-end-datepicker').val('#{(today + 7).strftime('%d/%m/%Y')}')")
|
||||
|
||||
fill_in 'call_for_papers_description', with: 'Cfp description'
|
||||
fill_in 'call_for_papers_rating', with: '4'
|
||||
fill_in 'call_for_paper_rating', with: '4'
|
||||
|
||||
click_button 'Create Call for papers'
|
||||
click_button 'Create Call for paper'
|
||||
|
||||
# Validations
|
||||
expect(flash).
|
||||
to eq('Call for Papers was successfully created.')
|
||||
expect(find('#conference-start-datepicker').value).
|
||||
to eq(today.strftime('%Y-%m-%d'))
|
||||
expect(find('#conference-end-datepicker').value).
|
||||
to eq((today + 7).strftime('%Y-%m-%d'))
|
||||
expect(find('#call_for_papers_description').text).
|
||||
to eq('Cfp description')
|
||||
expect(find('#call_for_papers_rating').value).to eq('4')
|
||||
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 + 7).strftime('%A, %B %-d. %Y'))
|
||||
expect(find('#rating').text).to eq('4')
|
||||
|
||||
expect(CallForPapers.count).to eq(expected_count)
|
||||
expect(CallForPaper.count).to eq(expected_count)
|
||||
end
|
||||
|
||||
scenario 'update cfp', feature: true, js: true do
|
||||
conference.call_for_papers = create(:call_for_papers)
|
||||
expected_count = CallForPapers.count
|
||||
conference.call_for_paper = create(:call_for_paper)
|
||||
expected_count = CallForPaper.count
|
||||
|
||||
sign_in organizer
|
||||
visit admin_conference_callforpapers_path(conference.short_title)
|
||||
visit admin_conference_call_for_paper_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 papers'
|
||||
click_button 'Update Call for paper'
|
||||
expect(flash).
|
||||
to eq('Updating call for papers failed. ' +
|
||||
"Start date can't be blank.")
|
||||
|
|
@ -67,21 +63,16 @@ feature Conference do
|
|||
page.execute_script(
|
||||
"$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
|
||||
|
||||
fill_in 'call_for_papers_description', with: 'Updated description'
|
||||
fill_in 'call_for_papers_rating', with: '0'
|
||||
click_button 'Update Call for papers'
|
||||
fill_in 'call_for_paper_rating', with: '0'
|
||||
click_button 'Update Call for paper'
|
||||
|
||||
# Validations
|
||||
expect(flash).
|
||||
to eq('Call for Papers was successfully updated.')
|
||||
expect(find('#conference-start-datepicker').value).
|
||||
to eq(today.strftime('%Y-%m-%d'))
|
||||
expect(find('#conference-end-datepicker').value).
|
||||
to eq((today + 14).strftime('%Y-%m-%d'))
|
||||
expect(find('#call_for_papers_description').text).
|
||||
to eq('Updated description')
|
||||
expect(find('#call_for_papers_rating').value).to eq('0')
|
||||
expect(CallForPapers.count).to eq(expected_count)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ feature Commercial do
|
|||
sign_in organizer
|
||||
|
||||
visit admin_conference_commercials_path(conference.short_title)
|
||||
click_link 'New Commercial'
|
||||
click_link 'Add Commercial'
|
||||
|
||||
# Create without an commercial id
|
||||
select('SlideShare', from: 'commercial_commercial_type')
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ feature Conference do
|
|||
expected_count = Conference.count
|
||||
|
||||
sign_in organizer
|
||||
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'conference_title', with: 'New Con'
|
||||
fill_in 'conference_short_title', with: ''
|
||||
|
||||
|
|
@ -49,9 +48,9 @@ feature Conference do
|
|||
expect(flash).
|
||||
to eq("Updating conference failed. Short title can't be blank.")
|
||||
|
||||
click_link 'Edit'
|
||||
fill_in 'conference_title', with: 'New Con'
|
||||
fill_in 'conference_short_title', with: 'NewCon'
|
||||
|
||||
day = Date.today + 10
|
||||
page.
|
||||
execute_script("$('#conference-start-datepicker').val('" +
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ feature Contact do
|
|||
sign_in organizer
|
||||
|
||||
visit edit_admin_conference_contact_path(conference.short_title)
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'contact_email', with: 'example@example.com'
|
||||
fill_in 'contact_sponsor_email', with: 'sponsor@example.com'
|
||||
fill_in 'contact_social_tag', with: 'example'
|
||||
|
|
@ -24,9 +24,9 @@ feature Contact do
|
|||
fill_in 'contact_googleplus', with: 'http:\\www.google.com'
|
||||
|
||||
click_button 'Update Contact'
|
||||
|
||||
expect(flash).
|
||||
to eq('Contact details were successfully updated.')
|
||||
|
||||
contact.reload
|
||||
expect(contact.email).to eq('example@example.com')
|
||||
expect(contact.sponsor_email).to eq('sponsor@example.com')
|
||||
|
|
|
|||
|
|
@ -6,47 +6,47 @@ feature DifficultyLevel do
|
|||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||
|
||||
shared_examples 'difficulty levels' do
|
||||
scenario 'adds and updates difficulty level', feature: true, js: true do
|
||||
scenario 'adds difficulty level', feature: true, js: true do
|
||||
|
||||
sign_in organizer
|
||||
visit admin_conference_difficulty_levels_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
# Add difficulty level
|
||||
click_link 'Add difficulty_level'
|
||||
expect(page.all('div.nested-fields').count == 1).to be true
|
||||
click_link 'Add Difficulty Level'
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
set('Example difficulty level')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
set('Example difficulty level description')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input').
|
||||
set('#ff0000')
|
||||
fill_in 'difficulty_level_title', with: 'Hard'
|
||||
fill_in 'difficulty_level_description', with: 'Life is the hardest'
|
||||
page.find('#difficulty_level_color').set('#ff0000')
|
||||
|
||||
click_button 'Update Conference'
|
||||
click_button 'Create Difficulty level'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Difficulty Levels were successfully updated.')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
value).to eq('Example difficulty level')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
value).to eq('Example difficulty level description')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input').
|
||||
value).to eq('#ff0000')
|
||||
expect(flash).to eq('Difficulty level successfully created.')
|
||||
within('table#difficulty_levels') do
|
||||
expect(page.has_content?('Hard')).to be true
|
||||
expect(page.has_content?('Life is the hardest')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'updates difficulty level', feature: true, js: true do
|
||||
|
||||
conference.difficulty_levels << create(:difficulty_level)
|
||||
sign_in organizer
|
||||
visit admin_conference_difficulty_levels_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
# Remove difficulty level
|
||||
click_link 'Remove difficulty_level'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_button 'Update Conference'
|
||||
expect(flash).to eq('Difficulty Levels were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_link 'Delete'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Difficulty level successfully deleted.')
|
||||
within('table#difficulty_levels') do
|
||||
expect(page.assert_selector('tr', count: 1)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'organizer' do
|
||||
|
|
|
|||
|
|
@ -12,45 +12,40 @@ feature EventType do
|
|||
visit admin_conference_event_types_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
expect(page.all('div.nested-fields').count == 2).to be true
|
||||
within('table#event_types') do
|
||||
expect(page.assert_selector('tr', count: 3)).to be true
|
||||
end
|
||||
|
||||
# Add event type
|
||||
click_link 'Add event_type'
|
||||
expect(page.all('div.nested-fields').count == 3).to be true
|
||||
click_link 'Add Event Type'
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input').
|
||||
set('Example event type')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input').
|
||||
set('60')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input').
|
||||
set('0')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input').
|
||||
set('300')
|
||||
fill_in 'event_type_title', with: 'Party'
|
||||
fill_in 'event_type_length', with: '240'
|
||||
fill_in 'event_type_minimum_abstract_length', with: '0'
|
||||
fill_in 'event_type_maximum_abstract_length', with: '13042'
|
||||
page.find('#event_type_color').set('#e4e4e4')
|
||||
|
||||
click_button 'Update Conference'
|
||||
click_button 'Create Event type'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Event types were successfully updated.')
|
||||
expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input').
|
||||
value).to eq('Example event type')
|
||||
expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input').
|
||||
value).to eq('60')
|
||||
expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input').
|
||||
value).to eq('0')
|
||||
expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input').
|
||||
value).to eq('300')
|
||||
expect(flash).to eq('Event type successfully created.')
|
||||
within('table#event_types') do
|
||||
expect(page.has_content?('Party')).to be true
|
||||
expect(page.has_content?('13042')).to be true
|
||||
expect(page.has_content?('#e4e4e4')).to be true
|
||||
expect(page.assert_selector('tr', count: 4)).to be true
|
||||
end
|
||||
|
||||
# Remove event type
|
||||
within('div.nested-fields:nth-of-type(3)') do
|
||||
click_link 'Remove event_type'
|
||||
within('tr', text: 'Party') do
|
||||
click_link 'Delete'
|
||||
end
|
||||
expect(flash).to eq('Event type successfully deleted.')
|
||||
|
||||
within('table#event_types') do
|
||||
expect(page.assert_selector('tr', count: 3)).to be true
|
||||
expect(page.has_content?('Party')).to be false
|
||||
end
|
||||
expect(page.all('div.nested-fields').count == 2).to be true
|
||||
click_button 'Update Conference'
|
||||
expect(flash).to eq('Event types were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 2).to be true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ feature Lodging do
|
|||
expect(page.has_content?('Example Hotel')).to be true
|
||||
|
||||
# Add lodging
|
||||
click_link 'Example Hotel'
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'lodging_name', with: 'New lodging'
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature Photo do
|
||||
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
||||
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
|
||||
|
||||
shared_examples 'add and update photo' do
|
||||
scenario 'adds a new photo', feature: true, js: true do
|
||||
expected_count = Photo.count + 1
|
||||
|
||||
sign_in organizer
|
||||
|
||||
visit new_admin_conference_photo_path(conference.short_title)
|
||||
|
||||
file_path = Rails.root.join('app', 'assets', 'images', 'rails.png')
|
||||
attach_file('photo_picture', file_path)
|
||||
fill_in 'photo_description', with: 'Lorem ipsum dolorem...'
|
||||
|
||||
click_button 'Save Photo'
|
||||
|
||||
expect(flash).
|
||||
to eq('Photo was successfully created.')
|
||||
expect(Photo.count).to eq(expected_count)
|
||||
end
|
||||
|
||||
scenario 'updates a photo', feature: true, js: true do
|
||||
expected_count = Photo.count + 1
|
||||
photo = create(:photo, conference_id: conference.id)
|
||||
sign_in organizer
|
||||
|
||||
visit edit_admin_conference_photo_path(conference.short_title, photo.id)
|
||||
|
||||
file_path = Rails.root.join('app', 'assets', 'images', 'person_large.png')
|
||||
attach_file('photo_picture', file_path)
|
||||
fill_in 'photo_description', with: 'Lorem ipsum dolorem...'
|
||||
|
||||
click_button 'Save Photo'
|
||||
|
||||
expect(flash).
|
||||
to eq('Photo was successfully updated.')
|
||||
expect(Photo.count).to eq(expected_count)
|
||||
end
|
||||
|
||||
scenario 'adds a text file', feature: true, js: true do
|
||||
expected_count = Photo.count
|
||||
sign_in organizer
|
||||
|
||||
visit new_admin_conference_photo_path(conference.short_title)
|
||||
|
||||
file_path = Rails.root + 'spec/fixtures/test.txt'
|
||||
attach_file('photo_picture', file_path)
|
||||
fill_in 'photo_description', with: 'Lorem ipsum dolorem...'
|
||||
|
||||
click_button 'Save Photo'
|
||||
|
||||
expect(flash).
|
||||
to eq('A error prohibited this Photo from being saved: Picture content type is invalid. Picture is invalid.')
|
||||
expect(Photo.count).to eq(expected_count)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'organizer' do
|
||||
it_behaves_like 'add and update photo'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -8,7 +8,7 @@ feature Event do
|
|||
let!(:participant_without_bio) { create(:user, biography: '') }
|
||||
|
||||
before(:each) do
|
||||
conference.call_for_papers = create(:call_for_papers)
|
||||
conference.call_for_paper = create(:call_for_paper)
|
||||
conference.event_types = [create(:event_type)]
|
||||
|
||||
@options = {}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ feature Room do
|
|||
expect(page.has_no_table?('#rooms')).to be true
|
||||
|
||||
# Add room
|
||||
click_link 'New Room'
|
||||
click_link 'Add Room'
|
||||
|
||||
fill_in 'room_name', with: 'Auditorium'
|
||||
fill_in 'room_size', with: '100'
|
||||
|
|
|
|||
|
|
@ -15,58 +15,30 @@ feature Sponsor do
|
|||
visit admin_conference_sponsors_path(
|
||||
conference_id: conference.short_title)
|
||||
# Add sponsors
|
||||
click_link 'Add sponsor'
|
||||
|
||||
expect(page.all('div.nested-fields').count == 1).to be true
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
set('Example sponsor')
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
set('Lorem Ipsum')
|
||||
click_link 'Add Sponsor'
|
||||
|
||||
fill_in 'sponsor_name', with: 'SUSE'
|
||||
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
|
||||
attach_file 'Logo', path
|
||||
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
|
||||
select('Platin', from: 'sponsor_sponsorship_level_id')
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
set('http://www.example.com')
|
||||
click_button 'Create Sponsor'
|
||||
|
||||
find(:css, "select[id^='conference_sponsors_attributes_']"\
|
||||
"[id$='_sponsorship_level_id']").
|
||||
find(:option, 'Platin').select_option
|
||||
|
||||
click_button 'Update Conference'
|
||||
|
||||
expect(flash).to eq('Sponsorships were successfully updated.')
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1)'\
|
||||
' div:nth-of-type(1) input').
|
||||
value).to eq('Example sponsor')
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1)'\
|
||||
' div:nth-of-type(2) textarea').
|
||||
value).to eq('Lorem Ipsum')
|
||||
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1)'\
|
||||
' div:nth-of-type(4) input').
|
||||
value).to eq('http://www.example.com')
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1)'\
|
||||
' div:nth-of-type(5) select:nth-of-type(1)').find('option[selected]').
|
||||
text).to eq('Platin')
|
||||
expect(flash).to eq('Sponsor successfully created.')
|
||||
within('table#sponsors') do
|
||||
expect(page.has_content?('SUSE')).to be true
|
||||
expect(page.has_content?('The original provider')).to be true
|
||||
expect(page.has_content?('http://www.suse.com')).to be true
|
||||
expect(page.has_content?('Platin')).to be true
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
end
|
||||
|
||||
# Remove sponsor
|
||||
click_link 'Remove sponsor'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
|
||||
find('button', text: 'Update Conference').trigger('click')
|
||||
|
||||
expect(flash).to eq('Sponsorships were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_link 'Delete'
|
||||
expect(flash).to eq('Sponsor successfully deleted.')
|
||||
expect(page).to_not have_selector('table#sponsors')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,47 +6,60 @@ feature Track do
|
|||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||
|
||||
shared_examples 'tracks' do
|
||||
scenario 'adds and updates tracks', feature: true, js: true do
|
||||
scenario 'adds a track', feature: true, js: true do
|
||||
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_tracks_path(
|
||||
conference_id: conference.short_title)
|
||||
visit admin_conference_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'New Track'
|
||||
|
||||
# Add track
|
||||
click_link 'Add track'
|
||||
expect(page.all('div.nested-fields').count == 1).to be true
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Create Track'
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
set('Example track')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
||||
set('#ff0000')
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) textarea').
|
||||
set('Example room description')
|
||||
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
|
||||
|
||||
click_button 'Update Conference'
|
||||
scenario 'deletes a track', feature: true, js: true do
|
||||
track = create(:track, conference_id: conference.id)
|
||||
sign_in organizer
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Tracks were successfully updated.')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
value).to eq('Example track')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
||||
value).to eq('#ff0000')
|
||||
expect(
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) textarea').
|
||||
value).to eq('Example room description')
|
||||
visit admin_conference_tracks_path(conference_id: conference.short_title)
|
||||
|
||||
# Remove track
|
||||
click_link 'Remove track'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_button 'Update Conference'
|
||||
expect(flash).to eq('Tracks were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_link 'Delete'
|
||||
|
||||
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.assert_selector('tr', count: 1)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'updates a track', feature: true, js: true do
|
||||
create(:track, conference_id: conference.id)
|
||||
sign_in organizer
|
||||
|
||||
visit admin_conference_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
page.find('#track_color').set('#B94D4D')
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue