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
Restore test of unsupported locale with message bird
Christophe Bliardbbbdc9b94736
diff --git a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rbindex 5520448b2c0..2835a123cf1 100644--- a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb+++ b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb@@ -1,11 +1,11 @@-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')+require_relative '../../spec_helper'require 'messagebird'describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird dolet(:channel) { :sms }let(:locale) { 'en' }- let(:user) { create :user, language: locale }- let(:device) { create :two_factor_authentication_device_sms, user:, channel: }+ let(:user) { create(:user, language: locale) }+ let(:device) { create(:two_factor_authentication_device_sms, user:, channel:) }let(:strategy) { described_class.new user:, device:, channel: }before do@@ -31,7 +31,7 @@ describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird doendend- context 'en' do+ context 'with en' dolet(:locale) { 'en' }it 'returns the correct language and message' do@@ -40,7 +40,7 @@ describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird doendend- context 'de' do+ context 'with de' dolet(:locale) { 'de' }it 'returns the correct language and message' do@@ -53,5 +53,19 @@ describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird doexpect(subject[:message]).to eql expected_messageendend++ context 'with unsupported locale ar (Arabic is not supported in message bird)' do+ let(:locale) { 'ar' }++ it 'falls back to english' do+ expected_message = I18n.t("two_factor_authentication.text_otp_delivery_message_sms",+ app_title: Setting.app_title,+ locale: 'en',+ token: '1234')++ expect(subject[:language]).to eq :'en-us'+ expect(subject[:message]).to eql expected_message+ end+ endendend