Fixed tests

This commit is contained in:
María Checa
2017-10-02 16:11:17 +02:00
parent 799e2475da
commit afbdd48891
4 changed files with 9 additions and 70 deletions

View File

@@ -489,15 +489,11 @@ en:
no_officers: "There are no officers assigned to this poll." no_officers: "There are no officers assigned to this poll."
table_name: "Name" table_name: "Name"
table_email: "Email" table_email: "Email"
add_officer_assignments: "Add shifts as officer"
edit_officer_assignments: "Edit officing shifts"
by_officer: by_officer:
date: "Date" date: "Date"
booth: "Booth" booth: "Booth"
assignments: "Officing shifts in this poll" assignments: "Officing shifts in this poll"
no_assignments: "This user has no officing shifts in this poll." no_assignments: "This user has no officing shifts in this poll."
total_recounts: "Total recounts"
total_recount: "Total recount (by officer)"
poll_shifts: poll_shifts:
new: new:
add_shift: "Add shift" add_shift: "Add shift"
@@ -570,7 +566,6 @@ en:
results_tab: Results results_tab: Results
no_questions: "There are no questions assigned to this poll." no_questions: "There are no questions assigned to this poll."
questions_title: "List of questions" questions_title: "List of questions"
remove_question: "Remove question from poll"
add_question: "Include question" add_question: "Include question"
table_title: "Title" table_title: "Title"
table_assignment: "Assignment" table_assignment: "Assignment"
@@ -578,8 +573,6 @@ en:
flash: flash:
question_added: "Question added to this poll" question_added: "Question added to this poll"
error_on_question_added: "Question could not be assigned to this poll" error_on_question_added: "Question could not be assigned to this poll"
question_removed: "Question removed from this poll"
error_on_question_removed: "Question could not be removed from this poll"
questions: questions:
index: index:
title: "Questions" title: "Questions"
@@ -606,7 +599,6 @@ en:
description: Description description: Description
video_url: External video video_url: External video
documents: Documents (1) documents: Documents (1)
preview: View on website
recounts: recounts:
index: index:
title: "Recounts" title: "Recounts"

View File

@@ -489,15 +489,11 @@ es:
no_officers: "No hay presidentes de mesa asignados a esta votación." no_officers: "No hay presidentes de mesa asignados a esta votación."
table_name: "Nombre" table_name: "Nombre"
table_email: "Email" table_email: "Email"
add_officer_assignments: "Añadir turnos como presidente de mesa"
edit_officer_assignments: "Editar turnos"
by_officer: by_officer:
date: "Fecha" date: "Fecha"
booth: "Urna" booth: "Urna"
assignments: "Turnos como presidente de mesa en esta votación" assignments: "Turnos como presidente de mesa en esta votación"
no_assignments: "No tiene turnos como presidente de mesa en esta votación." no_assignments: "No tiene turnos como presidente de mesa en esta votación."
total_recounts: "Recuentos totales"
total_recount: "Recuento total (presidente de mesa)"
poll_shifts: poll_shifts:
new: new:
add_shift: "Añadir turno" add_shift: "Añadir turno"
@@ -570,7 +566,6 @@ es:
results_tab: Resultados results_tab: Resultados
no_questions: "No hay preguntas asignadas a esta votación." no_questions: "No hay preguntas asignadas a esta votación."
questions_title: "Listado de preguntas asignadas" questions_title: "Listado de preguntas asignadas"
remove_question: "Desasignar pregunta"
add_question: "Incluir pregunta" add_question: "Incluir pregunta"
table_title: "Título" table_title: "Título"
table_assignment: "Asignación" table_assignment: "Asignación"
@@ -578,8 +573,6 @@ es:
flash: flash:
question_added: "Pregunta añadida a esta votación" question_added: "Pregunta añadida a esta votación"
error_on_question_added: "No se pudo asignar la pregunta" error_on_question_added: "No se pudo asignar la pregunta"
question_removed: "Pregunta eliminada de esta votación"
error_on_question_removed: "No se pudo quitar la pregunta"
questions: questions:
index: index:
title: "Preguntas ciudadanas" title: "Preguntas ciudadanas"
@@ -606,7 +599,6 @@ es:
description: Descripción description: Descripción
video_url: Video externo video_url: Video externo
documents: Documentos (1) documents: Documentos (1)
preview: Ver en la web
recounts: recounts:
index: index:
title: "Recuentos" title: "Recuentos"

View File

@@ -181,54 +181,6 @@ feature 'Admin polls' do
expect(page).to_not have_content "There are no questions assigned to this poll" expect(page).to_not have_content "There are no questions assigned to this poll"
end end
scenario 'Add question to poll', :js do
poll = create(:poll)
question = create(:poll_question, title: 'Should we rebuild the city?')
visit admin_poll_path(poll)
expect(page).to have_content 'Questions (0)'
expect(page).to have_content 'There are no questions assigned to this poll'
fill_in 'search-questions', with: 'rebuild'
click_button 'Search'
within('#search-questions-results') do
click_link 'Include question'
end
expect(page).to have_content 'Question added to this poll'
visit admin_poll_path(poll)
expect(page).to have_content 'Questions (1)'
expect(page).to_not have_content 'There are no questions assigned to this poll'
expect(page).to have_content question.title
end
scenario 'Remove question from poll', :js do
poll = create(:poll)
question = create(:poll_question, poll: poll)
visit admin_poll_path(poll)
expect(page).to have_content 'Questions (1)'
expect(page).to_not have_content 'There are no questions assigned to this poll'
expect(page).to have_content question.title
within("#poll_question_#{question.id}") do
click_link 'Remove question from poll'
end
expect(page).to have_content 'Question removed from this poll'
visit admin_poll_path(poll)
expect(page).to have_content 'Questions (0)'
expect(page).to have_content 'There are no questions assigned to this poll'
expect(page).to_not have_content question.title
end
end end
end end

View File

@@ -31,13 +31,14 @@ feature 'Admin shifts' do
end end
scenario "Create Vote Collection Shift", :js do scenario "Create Vote Collection Shift", :js do
poll = create(:poll) poll = create(:poll, :current)
vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) } vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
booth = create(:poll_booth) booth = create(:poll_booth)
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
officer = create(:poll_officer) officer = create(:poll_officer)
visit admin_booths_path visit available_admin_booths_path
within("#booth_#{booth.id}") do within("#booth_#{booth.id}") do
click_link "Manage shifts" click_link "Manage shifts"
@@ -63,13 +64,14 @@ feature 'Admin shifts' do
end end
scenario "Create Recount & Scrutiny Shift", :js do scenario "Create Recount & Scrutiny Shift", :js do
poll = create(:poll) poll = create(:poll, :current)
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) } recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
booth = create(:poll_booth) booth = create(:poll_booth)
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
officer = create(:poll_officer) officer = create(:poll_officer)
visit admin_booths_path visit available_admin_booths_path
within("#booth_#{booth.id}") do within("#booth_#{booth.id}") do
click_link "Manage shifts" click_link "Manage shifts"
@@ -97,11 +99,12 @@ feature 'Admin shifts' do
end end
scenario "Error on create", :js do scenario "Error on create", :js do
poll = create(:poll) poll = create(:poll, :current)
booth = create(:poll_booth) booth = create(:poll_booth)
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
officer = create(:poll_officer) officer = create(:poll_officer)
visit admin_booths_path visit available_admin_booths_path
within("#booth_#{booth.id}") do within("#booth_#{booth.id}") do
click_link "Manage shifts" click_link "Manage shifts"