- <%= image_tag("icon_home_debate.svg", size: "168x168") %> + <%= image_tag("icon_home_debate.png", size: "168x168", alt: t("welcome.debates.title")) %>

<%= t("welcome.debates.title") %>

<%= t("welcome.debates.description") %>

- <%= image_tag("icon_home_proposal.svg", size: "168x168") %> + <%= image_tag("icon_home_proposal.png", size: "168x168", alt: t("welcome.proposal.title")) %>

<%= t("welcome.proposal.title") %>

<%= t("welcome.proposal.description") %>

- <%= image_tag("icon_home_decide.svg", size: "168x168") %> + <%= image_tag("icon_home_decide.png", size: "168x168", alt: t("welcome.decide.title")) %>

<%= t("welcome.decide.title") %>

<%= t("welcome.decide.description") %>

- <%= image_tag("icon_home_done.svg", size: "168x168") %> + <%= image_tag("icon_home_do.png", size: "168x168", alt: t("welcome.do.title")) %>

<%= t("welcome.do.title") %>

<%= t("welcome.do.description") %>

diff --git a/app/views/welcome/welcome.html.erb b/app/views/welcome/welcome.html.erb index 181e9703b..34cc2b875 100644 --- a/app/views/welcome/welcome.html.erb +++ b/app/views/welcome/welcome.html.erb @@ -1,13 +1,27 @@

<%= t("welcome.welcome.title") %>

-

<%= t("welcome.welcome.instructions_1_html") %>

-

<%= t("welcome.welcome.instructions_2_html") %>

-

<%= t("welcome.welcome.instructions_3_html") %>

-

- <%= link_to t("welcome.welcome.verify_account"), - verification_path, class: "button success radius margin-top expand" %> -

-

- <%= link_to t("welcome.welcome.go_to_index"), - root_path, class: "small margin-top expand" %> -

-

<%= t("welcome.welcome.instructions_4_html") %>

+ +
+ +

<%= t("welcome.welcome.user_permission_info") %>

+ +
    +
  •  <%= t("welcome.welcome.user_permission_debates") %>
  • +
  •  <%= t("welcome.welcome.user_permission_proposal") %>
  • +
  •  <%= t("welcome.welcome.user_permission_support_proposal") %>
  • +
  •  <%= t("welcome.welcome.user_permission_votes") %>
  • +
+ +

+ <%= t("welcome.welcome.user_permission_verify_info") %> +

+ +

+ <%= t("welcome.welcome.user_permission_verify", + verify: link_to(t("welcome.welcome.user_permission_verify_url"), verification_path)).html_safe %> +

+ +

+ <%= link_to t("welcome.welcome.go_to_index"), + verification_path, class: "button success radius" %> +

+
diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 06cb48980..3bf203bc5 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -40,3 +40,13 @@ en: organization: name: Organization name responsible_name: Person in charge + errors: + models: + debate: + attributes: + tag_list: + less_than_or_equal_to: tags must be less than or equal to %{count} + proposal: + attributes: + tag_list: + less_than_or_equal_to: tags must be less than or equal to %{count} \ No newline at end of file diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index 89fba981c..b5db2f3ab 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -62,3 +62,13 @@ es: organization: name: Nombre de organización responsible_name: Persona responsable del colectivo + errors: + models: + debate: + attributes: + tag_list: + less_than_or_equal_to: los temas deben ser menor o igual que %{count} + proposal: + attributes: + tag_list: + less_than_or_equal_to: los temas deben ser menor o igual que %{count} diff --git a/config/locales/en.yml b/config/locales/en.yml index c71652799..14ca26510 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,7 @@ en: user_not_found: "User not found" layouts: header: + logo: "Madrid" external_link_transparency: Transparency external_link_transparency_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Transparencia?vgnextfmt=default&vgnextchannel=20fd850769797310VgnVCM2000000c205a0aRCRD" external_link_opendata: Open data @@ -13,19 +14,14 @@ en: external_link_blog_url: "/blog" open_gov: "%{open} government" open: "Open" - participation: Participation + participation: "Participation" + transparency: "Transparency" + open_data: "Open data" open_city_title: "The city you want, it will be the city you want." open_city_slogan_html: "Start listening to Madrid. For that we open this digital Puerta del Sol, where all the locals can meet to discuss and share everything we want." - # "Existen ciudades gobernadas directamente por sus habitantes, que debaten sobre temas que les preocupan, proponen ideas para mejorar - # sus vidas y deciden entre todas y todos las que se llevan a cabo. Madrid ya es una de ellas." - # open_city_text: - # "Here every voice has its place and are citizens, and no one in their name, they decide to vote debates what issues are - # most important of every time. Government officials have individual users with whom you may participate in the debates, and evaluated, - # the same level as everyone else. Because the Madrid City Council works for its citizens, and must respond to them." - # open_city_soon: "And soon... we'll open the section for citizen proposals." - see_all: See debates and proposals + see_all: "See proposals" my_account_link: My account locale: "Language:" administration: Administration @@ -47,7 +43,7 @@ en: transparency_text: Get any information on the City of Madrid. open_data_title: Open Data open_data_text: "All City Council data are yours." - contact_us: "Contact us" + contact_us: "For technical support contact us" privacy: "Privacy Policy" conditions: "Terms of use" more_info: "More information" @@ -59,6 +55,11 @@ en: For a better experience we recommend use %{chrome} or %{firefox}." chrome: "Google Chrome" firefox: "Firefox" + social: + twitter: "Twitter" + facebook: "Facebook" + blog: "Blog" + youtube: "YouTube" form: error: error errors: errors @@ -123,7 +124,7 @@ en: one: 1 Comment other: "%{count} Comments" login_to_comment: "You need to %{signin} or %{signup} to comment." - edit_debate_link: Edit + edit_debate_link: "Edit debate" share: Share flag: "This debate has been flag as innapropiate for some users." edit: @@ -158,7 +159,7 @@ en: select_order_long: Order proposals by orders: confidence_score: "most supported" - hot_score: most active + hot_score: "most active today" created_at: newest most_commented: most commented random: random @@ -214,7 +215,7 @@ en: one: 1 Comment other: "%{count} Comments" login_to_comment: "You need to %{signin} or %{signup} to comment." - edit_proposal_link: Edit + edit_proposal_link: "Edit proposal" share: Share flag: "This proposal has been flag as innapropiate for some users." edit: @@ -278,10 +279,9 @@ en: show: title: "My account" save_changes_submit: "Save changes" + change_credentials_link: "Change my credentials" email_on_comment_label: "Receive email when someone comments on my debates or proposals" email_on_comment_reply_label: "Receive email when someone replies to my comments" - change_credentials_link: "Change my credentials" - avatar: "Avatar" personal: "Personal data" username_label: "Username" phone_number_label: "Phone number" @@ -291,6 +291,14 @@ en: finish_verification: "Finish verification" verified_account: Verified account verify_my_account: Verify my account + user_permission_title: "Participation" + user_permission_info: "With your account you can..." + user_permission_debates: "Participate on debates" + user_permission_proposal: "Create new proposals" + user_permission_support_proposal: "Support proposals" + user_permission_votes: "Participate on final voting" + user_permission_verify: "To perform all the actions verify your account." + user_permission_verify_info: "* Only for users on Madrid City Census." simple_captcha: placeholder: "Enter the image value" label: "Enter the image value in the next form" @@ -313,6 +321,7 @@ en: manage: all: "You are not authorized to %{action} %{subject}." welcome: + highlights: "Highlights: " signed_in_home_title: Recent activity debates: title: "Debate" @@ -327,13 +336,16 @@ en: title: "It does" description: "If the proposal is accepted mostly, the City Council makes his own and done." welcome: - title: Account verification - instructions_1_html: "Welcome to the public participation website." - instructions_2_html: "We have detected that your email is confirmed but we were not able to verify your citizen data." - instructions_3_html: "Without verifying them, you have only partial access to the website. You need to be verified, for example, in order to participate in public proposals." - verify_account: "Verify my account now" - go_to_index: "I prefer to continue as a non-verified user with limited access" - instructions_4_html: "If you want to verify your account later on, you can do so in My account -> Verify my account." + title: "Participate" + go_to_index: "See proposals and debates" + user_permission_info: "With your account you can..." + user_permission_debates: "Participate on debates" + user_permission_proposal: "Create new proposals" + user_permission_support_proposal: "Support proposals*" + user_permission_votes: "Participate on final voting*" + user_permission_verify: "To perform all the actions %{verify}." + user_permission_verify_url: "verify your account" + user_permission_verify_info: "* Only for users on Madrid City Census." omniauth: finish_signup: title: Add Email diff --git a/config/locales/es.yml b/config/locales/es.yml index 9280f83db..866b2179e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -5,6 +5,7 @@ es: user_not_found: "No se encontró el usuario" layouts: header: + logo: "Madrid" external_link_transparency: Transparencia external_link_transparency_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Transparencia?vgnextfmt=default&vgnextchannel=20fd850769797310VgnVCM2000000c205a0aRCRD" external_link_opendata: Datos abiertos @@ -13,19 +14,14 @@ es: external_link_blog_url: "/blog" open_gov: "Gobierno %{open}" open: "abierto" - participation: Participación + participation: "Participación" + transparency: "Transparencia" + open_data: "Datos abiertos" open_city_title: "La ciudad que quieres será la ciudad que quieras." open_city_slogan_html: "Existen ciudades gobernadas directamente por sus habitantes, que debaten sobre temas que les preocupan, proponen ideas para mejorar sus vidas y deciden entre todas y todos las que se llevan a cabo. Madrid ya es una de ellas." - #"Empecemos escuchando qué tiene que decir Madrid. - #Para ello abrimos esta Puerta del Sol digital, donde toda la gente de Madrid podemos encontrarnos para debatir y compartir todo lo que queramos." - # open_city_text: - # "Aquí cualquier voz tiene su espacio y son los ciudadanos y ciudadanas, y nadie en su nombre, quienes deciden votando los debates cuáles son los temas - # más importantes de cada momento. Los responsables del gobierno tienen cuentas de usuario propias con las que podrán participar en los debates, y ser evaluados - # al mismo nivel que todos los demás." - # open_city_soon: "Muy pronto abriremos la sección de propuestas ciudadanas, donde cualquiera podrá presentar propuestas y, si reciben apoyo, serán puestas en marcha por el Ayuntamiento." - see_all: Ver debates y propuestas + see_all: "Ver propuestas" my_account_link: Mi cuenta locale: "Idioma:" administration: Administrar @@ -47,7 +43,7 @@ es: transparency_text: "Obtén cualquier información sobre el Ayuntamiento de Madrid." open_data_title: Datos Abiertos open_data_text: "Todos los datos del Ayuntamiento son tuyos." - contact_us: "Contacta con nosotros en" + contact_us: "Para asistencia técnica contáctenos en" privacy: "Política de privacidad" conditions: "Condiciones de uso" more_info: "Más información" @@ -59,6 +55,11 @@ es: Para una mejor experiencia te recomendamos utilizar %{chrome} o %{firefox}." chrome: "Google Chrome" firefox: "Firefox" + social: + twitter: "Twitter" + facebook: "Facebook" + blog: "Blog" + youtube: "YouTube" form: error: error errors: errores @@ -123,7 +124,7 @@ es: one: 1 Comentario other: "%{count} Comentarios" login_to_comment: "Necesitas %{signin} o %{signup} para comentar." - edit_debate_link: Editar + edit_debate_link: "Editar debate" share: Compartir flag: "Este debate ha sido marcado como inapropiado por varios usuarios." edit: @@ -158,7 +159,7 @@ es: select_order_long: Estás viendo las propuestas orders: confidence_score: "más apoyadas" - hot_score: "más activas" + hot_score: "más activas hoy" created_at: "más nuevas" most_commented: "más comentadas" random: "aleatorias" @@ -214,7 +215,7 @@ es: one: 1 Comentario other: "%{count} Comentarios" login_to_comment: "Necesitas %{signin} o %{signup} para comentar." - edit_proposal_link: Editar + edit_proposal_link: "Editar propuesta" share: Compartir flag: "Esta propuesta ha sido marcada como inapropiada por varios usuarios." edit: @@ -281,7 +282,6 @@ es: change_credentials_link: "Cambiar mis datos de acceso" email_on_comment_label: "Recibir un email cuando alguien comenta en mis propuestas o debates" email_on_comment_reply_label: "Recibir un email cuando alguien contesta a mis comentarios" - avatar: "Avatar" personal: "Datos personales" username_label: "Nombre de usuario" phone_number_label: "Teléfono" @@ -291,6 +291,14 @@ es: finish_verification: "Finalizar verificación" verified_account: Cuenta verificada verify_my_account: Verificar mi cuenta + user_permission_title: "Participación" + user_permission_info: "Con tu cuenta ya puedes..." + user_permission_debates: "Participar en debates" + user_permission_proposal: "Crear nuevas propuestas" + user_permission_support_proposal: "Apoyar propuestas*" + user_permission_votes: "Participar en las votaciones finales*" + user_permission_verify: "Para poder realizar todas las acciones verifica tu cuenta." + user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid." simple_captcha: placeholder: "Introduce el texto de la imagen" label: "Introduce el texto de la imagen en la siguiente caja" @@ -313,6 +321,7 @@ es: manage: all: "No tienes permiso para realizar la acción '%{action}' sobre %{subject}." welcome: + highlights: "Portada: " signed_in_home_title: Actividad reciente debates: title: "Debates" @@ -327,13 +336,16 @@ es: title: "Se hace" description: "Si la propuesta es aceptada mayoritariamente, el Ayuntamiento la asume como propia y se hace." welcome: - title: Verificación de cuenta - instructions_1_html: "Bienvenido a la página de participación ciudadana" - instructions_2_html: "Hemos detectado que tu dirección de email está confirmada pero no hemos verificado tus datos todavía." - instructions_3_html: "Sin verificar tus datos el acceso que tienes es limitado. Verificarlos ahora te permitirá, por ejemplo, apoyar propuestas ciudadanas." - verify_account: "Verificar mi cuenta" - go_to_index: "Quiero entrar como un usuario no verificado (acceso limitado)" - instructions_4_html: "Si quieres verificarte más tarde, puedes hacerlo en Mi cuenta > Verificar mi cuenta." + title: "Empieza a participar" + go_to_index: "Ver propuestas y debates" + user_permission_info: "Con tu cuenta ya puedes..." + user_permission_debates: "Participar en debates" + user_permission_proposal: "Crear nuevas propuestas" + user_permission_support_proposal: "Apoyar propuestas*" + user_permission_votes: "Participar en las votaciones finales*" + user_permission_verify: "Para poder realizar todas las acciones %{verify}." + user_permission_verify_url: "verifica tu cuenta" + user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid." omniauth: finish_signup: title: Añade tu email diff --git a/config/locales/verification.en.yml b/config/locales/verification.en.yml index 845f7a5e7..50e0d425b 100644 --- a/config/locales/verification.en.yml +++ b/config/locales/verification.en.yml @@ -2,10 +2,15 @@ en: verification: back: "Back to my account" step_1: "Residence" - step_2: "Confirmation code" + step_2: "SMS confirmation" step_3: "Final verification" alert: lock: "You have reached the maximum number of verification tries. Please try again later." + user_permission_info: "Verifing your information you'll be able to..." + user_permission_debates: "Participar en debates" + user_permission_proposal: "Crear nuevas propuestas" + user_permission_support_proposal: "Apoyar propuestas*" + user_permission_votes: "Participar en las votaciones finales*" residence: new: title: "Verify residence" @@ -17,6 +22,7 @@ en: document_number: "Document number" date_of_birth: "Date of birth" postal_code: "Postal code" + postal_code_note: "To verify your account you must be on Madrid city Census" accept_terms_text: "I accept %{terms_url} to access the city Census" terms: "the terms" verify_residence: "Verify residence" @@ -33,15 +39,16 @@ en: new: title: "Phone verification" phone: "Enter your phone for recive the code" + phone_note: "We only user your phone for send to you a code, we never contact to you." submit_button: "Send" create: flash: success: "Enter the confirmation code we have sent your phone" edit: - title: "Security code confirmation" + title: "Phone confirmation" confirmation_code: "Code confirmation" resend_sms_text: "You have not received the confirmation code in your phone?" - resend_sms_link: "Click here to send the confirmation code again" + resend_sms_link: "Request a new code" submit_button: "Send" update: error: "Incorrect confirmation code" @@ -64,23 +71,21 @@ en: letter: new: title: "Final Verification" - explanation_html: - "

Congratulations! You can now participate in discussions or support proposals of others.

To finish we need to verify your account completely provide you with a maximum security code, we ensure that no one is using your data on your behalf.

This requirement is essential to participate in final votes on motions. This can approach any Office of Citizen where you will verify in person, or in case you is impossible, we can send you a letter home with the code.

" - offices: "See Office of Citizen" + user_permission_info: "With your account you can..." + explanation: "For participate on final voting you can:" + office: "Verify in any %{office}" + offices: "Office of Citizen" offices_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" - send_letter: "Send me a letter with the code" - send_code: "Send" + send_letter: "Request a letter" + go_to_index: "See proposals" create: flash: - success_html: "Thank you for requesting a maximum security code in a few days we will send it to the address on your census data." - offices: "Oficinas de Atención al Ciudadano" + success_html: "Before voting you'll receive a letter whith the instructions for verify your account.
Remember you can verify your information in any %{offices}." + offices: "Office of Citizen" offices_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" edit: - title: "Empieza a participar" - confirmation_code: "Introduce aquí el código de máxima seguridad cuando recibas tu carta" - explanation_html: - "

¡Felicidades! Ya puedes participar en debates o apoyar propuestas de otras personas.

" - see_all: "Ver debates y propuestas" + title: "Letter requested" + see_all: "See proposals" update: flash: success: "Correct code. Your account is verified" diff --git a/config/locales/verification.es.yml b/config/locales/verification.es.yml index a90fc9fe2..fbd7c9499 100644 --- a/config/locales/verification.es.yml +++ b/config/locales/verification.es.yml @@ -2,10 +2,15 @@ es: verification: back: "Volver a mi cuenta" step_1: "Residencia" - step_2: "Código de confirmación" + step_2: "SMS de confirmación" step_3: "Verificación final" alert: lock: "Has llegado al máximo número de intentos. Por favor intentalo de nuevo más tarde." + user_permission_info: "Al verificar tus datos podrás..." + user_permission_debates: "Participar en debates" + user_permission_proposal: "Crear nuevas propuestas" + user_permission_support_proposal: "Apoyar propuestas" + user_permission_votes: "Participar en las votaciones finales" residence: new: title: "Verificar residencia" @@ -17,6 +22,7 @@ es: document_number: "Número de documento" date_of_birth: "Fecha de nacimiento" postal_code: "Código postal" + postal_code_note: "Para verificar tus datos debes estar empadronado en el municipio de Madrid" accept_terms_text: "Acepto %{terms_url} al Padrón" terms: "los términos de acceso" verify_residence: "Verificar residencia" @@ -31,17 +37,18 @@ es: unconfirmed_residency: "Aún no has verificado tu residencia" sms: new: - title: "Recibir código de confirmación" + title: "SMS de confirmación" phone: "Introduce tu teléfono móvil para recibir el código" + phone_note: "Sólo usaremos tu teléfono para enviarte un código, nunca te contactaremos." submit_button: "Enviar" create: flash: success: "Introduce el código de confirmación que te hemos enviado por mensaje de texto" edit: - title: "Confirmación de código de seguridad" + title: "SMS de confirmación" confirmation_code: "Introduce el código que has recibido en tu móvil" resend_sms_text: "¿No has recibido un mensaje de texto con tu código de confirmación?" - resend_sms_link: "Haz click aquí para volver a enviártelo" + resend_sms_link: "Solicitar un nuevo código" submit_button: "Enviar" update: error: "Código de confirmación incorrecto" @@ -63,24 +70,22 @@ es: failure: "Hubo un problema enviándote un email a tu cuenta" letter: new: - title: "Verificación Final" - explanation_html: - "

¡Felicidades! Ya puedes participar en debates o apoyar propuestas de otras personas.

Para terminar de verificar tu cuenta completamente necesitamos proporcionarte un código de máxima seguridad, que nos asegure que nadie está utilizando tus datos en tu nombre.

Este requerimiento es esencial para participar en las votaciones finales de las propuestas. Para ello puedes acercarte a cualquier Oficina de Atención al Ciudadano donde te verificarán presencialmente, o en caso de que te sea imposible, podemos mandarte una carta a casa con el código.

" - offices: "Ver Oficinas de Atención al Ciudadano" + title: "¡Felicidades!" + user_permission_info: "Con tu cuenta ya puedes..." + explanation: "Para participar en las votaciones finales puedes:" + office: "Verificarte presencialmente en cualquier %{office}" + offices: "Oficina de Atención al Ciudadano" offices_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" - send_letter: "Enviarme una carta con el código" - send_code: "Enviar" + send_letter: "Solicitar una carta por correo postal" + go_to_index: "Ver propuestas" create: flash: - success_html: "Gracias por solicitar tu código de máxima seguridad (solo necesario para las votaciones finales), en unos días te lo enviaremos a la dirección que figura en tus datos del padrón. Recuerda que puedes ahorrar el envío recogiendo tu código en cualquiera de las %{offices}." + success_html: "Antes de las votaciones recibirás una carta con las instrucciones para verificar tu cuenta.
Recuerda que puedes ahorrar el envío verificándote presencialmente en cualquiera de las %{offices}." offices: "Oficinas de Atención al Ciudadano" offices_url: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" edit: - title: "Empieza a participar" - confirmation_code: "Introduce aquí el código de máxima seguridad cuando recibas tu carta" - explanation_html: - "

¡Felicidades! Ya puedes participar en debates o apoyar propuestas de otras personas.

" - see_all: "Ver debates y propuestas" + title: "Carta solicitada" + see_all: "Ver propuestas" update: flash: success: "Código correcto. Tu cuenta ya está verificada" diff --git a/db/seeds.rb b/db/seeds.rb index cef67b0f6..8e65d2925 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,5 +1,5 @@ # Default admin user (change password after first deploy to a server!) -if Administrator.count == 0 +if Administrator.count == 0 && !Rails.env.test? admin = User.create!(username: 'admin', email: 'admin@madrid.es', password: '12345678', password_confirmation: '12345678', confirmed_at: Time.now, terms_of_service: "1") admin.create_administrator end diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index e542feb99..c633f1b2f 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -55,9 +55,10 @@ feature 'Debates' do debate = create(:debate, title: 'Test Debate 1') visit debates_path(order: :hot_score, page: 1) - find(:xpath, "//a[@href='/debates/#{debate.id}']", match: :first).click + first(:link, debate.title).click + link_text = find_link('Back')[:href] - expect(find_link('Back')[:href]).to include(debates_path order: :hot_score, page: 1) + expect(link_text).to include(debates_path order: :hot_score, page: 1) end scenario 'Create' do @@ -183,7 +184,7 @@ feature 'Debates' do expect(page).not_to have_link('click me') expect(page.html).to_not include "" - click_link 'Edit' + click_link 'Edit debate' expect(current_path).to eq edit_debate_path(Debate.last) expect(page).not_to have_link('click me') @@ -339,13 +340,13 @@ feature 'Debates' do describe 'Limiting tags shown' do scenario 'Index page shows up to 5 tags per debate' do - tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"] + tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] create :debate, tag_list: tag_list visit debates_path within('.debate .tags') do - expect(page).to have_content '2+' + expect(page).to have_content '1+' end end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 453f3053a..7bb1146ec 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -253,7 +253,7 @@ feature 'Proposals' do expect(page).not_to have_link('click me') expect(page.html).to_not include "" - click_link 'Edit' + click_link 'Edit proposal' expect(current_path).to eq edit_proposal_path(Proposal.last) expect(page).not_to have_link('click me') @@ -422,13 +422,13 @@ feature 'Proposals' do describe 'Limiting tags shown' do scenario 'Index page shows up to 5 tags per proposal' do - tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"] + tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] create :proposal, tag_list: tag_list visit proposals_path within('.proposal .tags') do - expect(page).to have_content '2+' + expect(page).to have_content '1+' end end diff --git a/spec/features/stats_spec.rb b/spec/features/stats_spec.rb index ef8d15ad5..b0360aeb1 100644 --- a/spec/features/stats_spec.rb +++ b/spec/features/stats_spec.rb @@ -42,16 +42,10 @@ feature 'Stats' do end scenario 'Users' do - Administrator.destroy_all - User.all.map(&:really_destroy!) - 1.times { create(:user, :level_three) } 2.times { create(:user, :level_two) } 3.times { create(:user) } - admin = create(:administrator) - login_as(admin.user) - visit admin_stats_path expect(page).to have_content "Level three users 1" diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb index 232c220c0..3f310071e 100644 --- a/spec/features/tags_spec.rb +++ b/spec/features/tags_spec.rb @@ -90,6 +90,24 @@ feature 'Tags' do expect(page).to have_content 'Impuestos' end + scenario 'Create with too many tags' do + user = create(:user) + login_as(user) + + visit new_debate_path + fill_in 'debate_title', with: 'Title' + fill_in 'debate_description', with: 'Description' + fill_in 'debate_captcha', with: correct_captcha_text + check 'debate_terms_of_service' + + fill_in 'debate_tag_list', with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad" + + click_button 'Start a debate' + + expect(page).to have_content '1 error prohibited this debate from being saved:' + expect(page).to have_content 'tags must be less than or equal to 6' + end + scenario 'Update' do debate = create(:debate, tag_list: 'Economía') diff --git a/spec/features/verification/letter_spec.rb b/spec/features/verification/letter_spec.rb index 8c9282800..d4b7eeb30 100644 --- a/spec/features/verification/letter_spec.rb +++ b/spec/features/verification/letter_spec.rb @@ -10,15 +10,9 @@ feature 'Verify Letter' do login_as(user) visit new_letter_path - click_button "Send me a letter with the code" + click_link "Request a letter" - expect(page).to have_content "Thank you for requesting a maximum security code in a few days we will send it to the address on your census data." - - user.reload - fill_in "letter_verification_code", with: user.letter_verification_code - click_button "Send" - - expect(page).to have_content "Correct code. Your account is verified" + expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account." end scenario 'Go to office instead of send letter' do @@ -29,7 +23,7 @@ feature 'Verify Letter' do login_as(user) visit new_letter_path - expect(page).to have_link "See Office of Citizen", href: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" + expect(page).to have_link "Office of Citizen", href: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" end scenario 'Errors on verification code' do @@ -40,13 +34,9 @@ feature 'Verify Letter' do login_as(user) visit new_letter_path - click_button "Send me a letter with the code" - expect(page).to have_content "Thank you for requesting a maximum security code in a few days we will send it to the address on your census data." + click_link "Request a letter" + expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account." - fill_in "letter_verification_code", with: "1" - click_button "Send" - - expect(page).to have_content "Incorrect confirmation code" end scenario "Deny access unless verified residence" do @@ -68,25 +58,4 @@ feature 'Verify Letter' do expect(page).to have_content 'You have not yet enter the confirmation code' expect(current_path).to eq(new_sms_path) end - - scenario '6 tries allowed' do - user = create(:user, residence_verified_at: Time.now, confirmed_phone: "611111111") - login_as(user) - - visit new_letter_path - click_button 'Send me a letter with the code' - - 6.times do - fill_in 'letter_verification_code', with: "999999" - click_button 'Send' - end - - expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later." - expect(current_path).to eq(account_path) - - visit new_letter_path - expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later." - expect(current_path).to eq(account_path) - end - end diff --git a/spec/features/verification/level_three_verification_spec.rb b/spec/features/verification/level_three_verification_spec.rb index 86368ff6b..b03741f42 100644 --- a/spec/features/verification/level_three_verification_spec.rb +++ b/spec/features/verification/level_three_verification_spec.rb @@ -20,7 +20,7 @@ feature 'Level three verification' do click_button "Send code" end - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' user = user.reload fill_in 'sms_confirmation_code', with: user.sms_confirmation_code @@ -75,7 +75,7 @@ feature 'Level three verification' do fill_in 'sms_phone', with: "611111111" click_button 'Send' - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' user = user.reload fill_in 'sms_confirmation_code', with: user.sms_confirmation_code @@ -83,14 +83,8 @@ feature 'Level three verification' do expect(page).to have_content 'Correct code' - click_button "Send me a letter with the code" + click_link "Request a letter" - expect(page).to have_content "Thank you for requesting a maximum security code in a few days we will send it to the address on your census data." - - user.reload - fill_in "letter_verification_code", with: user.letter_verification_code - click_button "Send" - - expect(page).to have_content "We have not sent you the letter with the code yet" + expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account." end end \ No newline at end of file diff --git a/spec/features/verification/level_two_verification_spec.rb b/spec/features/verification/level_two_verification_spec.rb index dfb1e29c2..ac0bf1a2f 100644 --- a/spec/features/verification/level_two_verification_spec.rb +++ b/spec/features/verification/level_two_verification_spec.rb @@ -14,7 +14,7 @@ feature 'Level two verification' do fill_in 'sms_phone', with: "611111111" click_button 'Send' - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' user = user.reload fill_in 'sms_confirmation_code', with: user.sms_confirmation_code diff --git a/spec/features/verification/sms_spec.rb b/spec/features/verification/sms_spec.rb index 3afe33a43..1d8026b81 100644 --- a/spec/features/verification/sms_spec.rb +++ b/spec/features/verification/sms_spec.rb @@ -11,7 +11,7 @@ feature 'SMS Verification' do fill_in 'sms_phone', with: "611111111" click_button 'Send' - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' user = user.reload fill_in 'sms_confirmation_code', with: user.sms_confirmation_code @@ -40,7 +40,7 @@ feature 'SMS Verification' do fill_in 'sms_phone', with: "611111111" click_button 'Send' - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' click_button 'Send' @@ -66,7 +66,7 @@ feature 'SMS Verification' do 5.times do fill_in 'sms_phone', with: "611111111" click_button 'Send' - click_link 'Click here to send the confirmation code again' + click_link 'Request a new code' end expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later." diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index c4ac619b0..a9ef3892a 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -57,10 +57,22 @@ describe Debate do end end - it "should sanitize the tag list" do - debate.tag_list = "user_id=1" - debate.valid? - expect(debate.tag_list).to eq(['user_id1']) + describe "#tag_list" do + it "should sanitize the tag list" do + debate.tag_list = "user_id=1" + debate.valid? + expect(debate.tag_list).to eq(['user_id1']) + end + + it "should not be valid with a tag list of more than 6 elements" do + debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"] + expect(debate).to_not be_valid + end + + it "should be valid with a tag list of 6 elements" do + debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] + expect(debate).to be_valid + end end it "should not be valid without accepting terms of service" do diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 8b58d0eec..6e5acb379 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -99,10 +99,22 @@ describe Proposal do end end - it "should sanitize the tag list" do - proposal.tag_list = "user_id=1" - proposal.valid? - expect(proposal.tag_list).to eq(['user_id1']) + describe "tag_list" do + it "should sanitize the tag list" do + proposal.tag_list = "user_id=1" + proposal.valid? + expect(proposal.tag_list).to eq(['user_id1']) + end + + it "should not be valid with a tag list of more than 6 elements" do + proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"] + expect(proposal).to_not be_valid + end + + it "should be valid with a tag list of more than 6 elements" do + proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] + expect(proposal).to be_valid + end end it "should not be valid without accepting terms of service" do @@ -113,7 +125,7 @@ describe Proposal do it "should have a code" do Setting.find_by(key: "proposal_code_prefix").update(value: "TEST") proposal = create(:proposal) - expect(proposal.code).to eq "TEST-#{proposal.created_at.strftime('%Y-%M')}-#{proposal.id}" + expect(proposal.code).to eq "TEST-#{proposal.created_at.strftime('%Y-%m')}-#{proposal.id}" end describe "#editable?" do diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 4dc8294db..d57a5eaac 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -135,7 +135,7 @@ module CommonActions fill_in 'sms_phone', with: "611111111" click_button 'Send' - expect(page).to have_content 'Security code confirmation' + expect(page).to have_content 'Phone confirmation' user = User.last.reload fill_in 'sms_confirmation_code', with: user.sms_confirmation_code