From 7164672ba6759eeb964ad8a56a1110d73eadb8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ce=C4=BEuch?= Date: Mon, 11 Sep 2023 13:21:53 +0200 Subject: [PATCH] Fix parliament vote app email template format on some iPhones (#599) * replace n with rn and fix typo in email subject * fix tests * bump ruby and some gems to fix tests --- .ruby-version | 2 +- Gemfile | 10 ++-- Gemfile.lock | 52 +++++++++---------- .../parliament_vote_app/application_form.rb | 4 +- .../authorized_person_send.html.erb | 2 +- .../application_forms/send.html.erb | 2 +- .../features/apps/parliament_vote_app_spec.rb | 2 +- spec/support/capybara.rb | 1 - 8 files changed, 37 insertions(+), 38 deletions(-) diff --git a/.ruby-version b/.ruby-version index e4604e3a..be94e6f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.1 +3.2.2 diff --git a/Gemfile b/Gemfile index aacfd44a..4f68c633 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.2.1' +ruby '3.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.1.7.3' @@ -80,7 +80,7 @@ group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'dotenv-rails' gem 'factory_bot_rails' - gem 'rspec-rails', '4.0.0.beta4' + gem 'rspec-rails', '4.0.2' gem 'rspec_junit_formatter' gem 'faker' end @@ -98,10 +98,10 @@ end group :test do # Adds support for Capybara system testing and selenium driver - gem 'capybara' + gem 'capybara', "~> 3.39.2" gem 'show_me_the_cookies' - gem 'selenium-webdriver' - gem 'webdrivers' + gem 'selenium-webdriver', "~> 4.9.0" + gem "webdrivers", "= 5.3.0" gem 'simplecov', '< 0.18' # https://github.com/codeclimate/test-reporter/issues/413 end diff --git a/Gemfile.lock b/Gemfile.lock index c739a434..c467c3fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) aws-eventstream (1.2.0) aws-partitions (1.734.0) @@ -111,7 +111,7 @@ GEM msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capybara (3.38.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -227,8 +227,8 @@ GEM marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.1) + mini_mime (1.1.5) + mini_portile2 (2.8.4) minitest (5.18.0) msgpack (1.6.1) multi_xml (0.6.0) @@ -244,8 +244,8 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.14.3) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -287,15 +287,15 @@ GEM method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (5.0.1) + public_suffix (5.0.3) puma (6.1.1) nio4r (~> 2.0) que (2.2.0) que-web (0.10.0) que (>= 1) sinatra - racc (1.6.2) - rack (2.2.6.4) + racc (1.7.1) + rack (2.2.8) rack-protection (3.0.5) rack rack-proxy (0.7.6) @@ -337,28 +337,28 @@ GEM ffi (~> 1.0) recaptcha (5.12.3) json - regexp_parser (2.7.0) + regexp_parser (2.8.1) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.2.6) rollbar (3.4.0) rspec-core (3.12.1) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.4) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (4.0.0.beta4) + rspec-rails (4.0.2) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) - rspec-core (~> 3.9) - rspec-expectations (~> 3.9) - rspec-mocks (~> 3.9) - rspec-support (~> 3.9) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) @@ -374,7 +374,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.8.1) + selenium-webdriver (4.9.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -435,10 +435,10 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.2.0) + webdrivers (5.3.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0) + selenium-webdriver (~> 4.0, < 4.11) webpacker (5.4.4) activesupport (>= 5.2) rack-proxy (>= 0.6.1) @@ -461,7 +461,7 @@ DEPENDENCIES aws-sdk-s3 bootsnap byebug - capybara + capybara (~> 3.39.2) clockwork dotenv-rails exception_handler @@ -493,10 +493,10 @@ DEPENDENCIES rails-i18n recaptcha rollbar - rspec-rails (= 4.0.0.beta4) + rspec-rails (= 4.0.2) rspec_junit_formatter sass-rails - selenium-webdriver + selenium-webdriver (~> 4.9.0) show_me_the_cookies sib-api-v3-sdk simplecov (< 0.18) @@ -509,11 +509,11 @@ DEPENDENCIES validate_url wdm (~> 0.1.0) web-console - webdrivers + webdrivers (= 5.3.0) webpacker RUBY VERSION - ruby 3.2.1p31 + ruby 3.2.2p53 BUNDLED WITH 2.1.4 diff --git a/app/models/apps/parliament_vote_app/application_form.rb b/app/models/apps/parliament_vote_app/application_form.rb index e26dc18e..b72370ca 100644 --- a/app/models/apps/parliament_vote_app/application_form.rb +++ b/app/models/apps/parliament_vote_app/application_form.rb @@ -131,14 +131,14 @@ def from_slovakia_email_body ActionController::Base.new.render_to_string( partial: "apps/parliament_vote_app/application_forms/from_slovakia_email_body", locals: { model: self }, - ) + ).gsub(/\n/, "\r\n") end def from_slovakia_authorized_person_email_body ActionController::Base.new.render_to_string( partial: "apps/parliament_vote_app/application_forms/from_slovakia_authorized_person_email_body", locals: { model: self }, - ) + ).gsub(/\n/, "\r\n") end def world_abroad_resident_email_body diff --git a/app/views/apps/parliament_vote_app/application_forms/authorized_person_send.html.erb b/app/views/apps/parliament_vote_app/application_forms/authorized_person_send.html.erb index 26884d08..ebfe5131 100644 --- a/app/views/apps/parliament_vote_app/application_forms/authorized_person_send.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/authorized_person_send.html.erb @@ -11,7 +11,7 @@ <%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe, target: '_blank', body: @application_form.from_slovakia_authorized_person_email_body, - subject: 'Žiadosť o hlasovací preukaz do parlamentých volieb.' + subject: 'Žiadosť o hlasovací preukaz do parlamentných volieb.' %> alebo ju manuálne skopírujte a odošlite na emailovú adresu obce: <%= mail_to @application_form.municipality_email, @application_form.municipality_email %> diff --git a/app/views/apps/parliament_vote_app/application_forms/send.html.erb b/app/views/apps/parliament_vote_app/application_forms/send.html.erb index 69200634..0d0b0d6e 100644 --- a/app/views/apps/parliament_vote_app/application_forms/send.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/send.html.erb @@ -11,7 +11,7 @@ <%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe, target: '_blank', body: @application_form.from_slovakia_email_body, - subject: 'Žiadosť o hlasovací preukaz do parlamentých volieb.' + subject: 'Žiadosť o hlasovací preukaz do parlamentných volieb.' %> alebo ju manuálne skopírujte a odošlite na emailovú adresu obce: <%= mail_to @application_form.municipality_email, @application_form.municipality_email %> diff --git a/spec/features/apps/parliament_vote_app_spec.rb b/spec/features/apps/parliament_vote_app_spec.rb index ba5b06b6..f1f335ea 100644 --- a/spec/features/apps/parliament_vote_app_spec.rb +++ b/spec/features/apps/parliament_vote_app_spec.rb @@ -146,7 +146,7 @@ def start expect(page).to have_content('Meno: Ferko Mrkva') expect(page).to have_content('Rodné číslo: 123') expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves') - expect(page).to have_content('Preukaz vyzdvihne splnomocnená osoba: Meno: Jarko Mrkva Číslo občianskeho preukazu: 567') + expect(page).to have_content("Preukaz vyzdvihne splnomocnená osoba:\r \r Meno: Jarko Mrkva\r Číslo občianskeho preukazu: 567") check 'Poslal/a som žiadosť na úrad' end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 6a1558e4..d813b946 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,4 +1,3 @@ -Webdrivers::Chromedriver.required_version = "114.0.5735.90" Webdrivers::Chromedriver.update Capybara.register_driver :chrome do |app|