From 0e54b8a6b1a2dbb377b8bbfb937287033e82ea98 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Fri, 5 Oct 2018 10:02:50 +0100 Subject: [PATCH] (maint) - Updating loc tests to include Japanese translations --- spec/acceptance/locales_spec.rb | 45 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/spec/acceptance/locales_spec.rb b/spec/acceptance/locales_spec.rb index eaf214d..121f79a 100644 --- a/spec/acceptance/locales_spec.rb +++ b/spec/acceptance/locales_spec.rb @@ -1,17 +1,10 @@ require 'spec_helper_acceptance' + require 'beaker/i18n_helper' PUPPETLABS_GPG_KEY_LONG_ID = '7F438280EF8D349F'.freeze PUPPETLABS_LONG_FINGERPRINT = '123456781274D2C8A956789A456789A456789A9A'.freeze -id_short_warning_pp = <<-MANIFEST - apt_key { 'puppetlabs': - id => '#{PUPPETLABS_GPG_KEY_LONG_ID}', - ensure => 'present', - source => 'http://apt.puppetlabs.com/herpderp.gpg', - } - MANIFEST - id_doesnt_match_fingerprint_pp = <<-MANIFEST apt_key { '#{PUPPETLABS_LONG_FINGERPRINT}': ensure => 'present', @@ -30,7 +23,13 @@ location_not_specified_fail_pp = <<-MANIFEST } MANIFEST -describe 'apt', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do + no_content_param = <<-MANIFEST + apt_key { '#{123456781274D2C8A956789A456789A456789A9A}': + ensure => 'present', + } + MANIFEST + +describe 'localization', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do before :all do hosts.each do |host| on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb") @@ -38,20 +37,28 @@ describe 'apt', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat end end - describe 'i18n translations' do - it 'warns with shortened id' do - apply_manifest(id_short_warning_pp, catch_failures: true) do |r| - expect(r.stderr).to match(%r{Ŧħḗ īḓ şħǿŭŀḓ ƀḗ ȧ ƒŭŀŀ ƒīƞɠḗřƥřīƞŧ}) - end - end - it 'fails with different id and fingerprint' do + describe 'ruby translations' do + it 'fails with interpolated string' do apply_manifest(id_doesnt_match_fingerprint_pp, expect_failures: true) do |r| - expect(r.stderr).to match(%r{Ŧħḗ īḓ īƞ ẏǿŭř ḿȧƞīƒḗşŧ 123456781274D2C8A956789A456789A456789A9A}) + expect(r.stderr).to match(%r{を設定できませんでした: マニフェスト123456781274D2C8A956789A456789A456789A9Aに含まれるidと、content/sourceのフィンガープリントが一致しません。idに間違いがないか、content/sourceが正当であるかを確認してください}) end end - it 'fails with no location' do + it 'fails with simple string' do apply_manifest(location_not_specified_fail_pp, expect_failures: true) do |r| - expect(r.stderr).to match(%r{ƈȧƞƞǿŧ ƈřḗȧŧḗ ȧ şǿŭřƈḗ ḗƞŧřẏ ẇīŧħǿŭŧ şƥḗƈīƒẏīƞɠ ȧ ŀǿƈȧŧīǿƞ}) + expect(r.stderr).to match(%r{の検証中にエラーが生じました。Evaluation Error: a Function Callの検証中にエラーが生じました。場所を指定せずにソースエントリを作成することはできません}) + end + end + end + + describe 'puppet translations' do + it 'fails with interpolated string' do + apply_manifest(no_content_param, expect_failures: true) do |r| + expect(r.stderr).to match(%r{contentパラメータを渡す必要があります}) + end + end + it 'fails with simple string' do + apply_manifest(no_content_param, expect_failures: true) do |r| + expect(r.stderr).to match(%r{need a test}) end end end -- 2.45.2