Add RemoteTranslation validations

- Validate that locale is a valid locale for RemoteTranslation Client.
- RemoteTranslation can only be created for resources that do not have the requested
language translated
This commit is contained in:
taitus
2020-01-23 15:55:24 +01:00
parent 086e38c969
commit d853366d38
6 changed files with 28 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
before do
Setting["feature.remote_translations"] = true
available_locales_response = %w[de en es fr pt zh-Hans]
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(3).times.
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times.
and_return(available_locales_response)
allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123")
end