OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
adapt feature spec to altered accept language precedence
ulferts1c81ff519cdb
diff --git a/app/helpers/user_consent_helper.rb b/app/helpers/user_consent_helper.rbindex a0c3c3b1400..f7aaa07de5f 100644--- a/app/helpers/user_consent_helper.rb+++ b/app/helpers/user_consent_helper.rb@@ -28,7 +28,6 @@#++module ::UserConsentHelper-def consent_param?params[:consent_check].present?enddiff --git a/app/services/set_localization_service.rb b/app/services/set_localization_service.rbindex 3decce3504f..c226f408102 100644--- a/app/services/set_localization_service.rb+++ b/app/services/set_localization_service.rb@@ -29,6 +29,7 @@ class SetLocalizationServicedef header_languagereturn unless http_accept_header+accept_lang = parse_qvalues(http_accept_header).firstfind_language_or_prefix accept_langend@@ -54,13 +55,15 @@ class SetLocalizationServicetmp = tmp.sort_by { |_val, q| -q }tmp.map! { |val, _q| val }end- return tmp++ tmprescuenilenddef find_language_or_prefix(language)return nil unless language+language = language.to_s.downcasefind_language(language) || find_language(language.split('-').first)enddiff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rbindex 86a104ef785..322c2a1ff04 100644--- a/spec/features/auth/consent_auth_stage_spec.rb+++ b/spec/features/auth/consent_auth_stage_spec.rb@@ -28,7 +28,7 @@require 'spec_helper'-describe 'Authentication Stages', type: :feature, js: true do+describe 'Authentication Stages', type: :feature dolet(:language) { 'en' }let(:user_password) { 'bob' * 4 }let(:user) do@@ -84,12 +84,16 @@ describe 'Authentication Stages', type: :feature, js: true doexpect_logged_inendend+context 'when enabled, localized consent exists',with_settings: { consent_info: { de: '# Einwilligung', en: '# Consent header!' } } dolet(:consent_required) { true }- let(:language) { 'de' }- it 'should show localized consent' do+ before do+ Capybara.current_session.driver.header('Accept-Language', 'de')+ end++ it 'should show localized consent as defined by the accept language header (ignoring users language)' dologin_with user.login, user_passwordexpect(page).to have_selector('.account-consent')@@ -97,7 +101,7 @@ describe 'Authentication Stages', type: :feature, js: true doendend- context 'when enabled, but consent exists', with_settings: { consent_info: { en: '# Consent header!' } } do+ context 'when enabled, but consent exists', js: true, with_settings: { consent_info: { en: '# Consent header!' } } dolet(:consent_required) { true }after do