Sha256: f1de43406e93900aef921554ffb3af888cec8942d2700cddc1954ba290c0d6ee

Contents?: true

Size: 1.06 KB

Versions: 128

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe 'compiler localization' do
  include_context 'l10n', 'ja'

  let(:envdir) { File.join(my_fixture_dir, '..', 'envs') }
  let(:environments) do
    Puppet::Environments::Cached.new(
      Puppet::Environments::Directories.new(envdir, [])
    )
  end
  let(:env) { Puppet::Node::Environment.create(:prod, [File.join(envdir, 'prod', 'modules')]) }
  let(:node) { Puppet::Node.new('test', :environment => env) }

  around(:each) do |example|
    Puppet.override(current_environment: env,
                    loaders: Puppet::Pops::Loaders.new(env),
                    environments: environments) do
      example.run
    end
  end

  it 'localizes strings in functions' do
    Puppet[:code] = <<~END
      notify { 'demo':
        message => l10n()
      }
    END

    Puppet::Resource::Catalog.indirection.terminus_class = :compiler
    catalog = Puppet::Resource::Catalog.indirection.find(node.name)
    resource = catalog.resource(:notify, 'demo')

    expect(resource).to be
    expect(resource[:message]).to eq("それは楽しい時間です")
  end
end

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/integration/l10n/compiler_spec.rb
puppet-8.3.0-x86-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.3.0-x64-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.3.0-universal-darwin spec/integration/l10n/compiler_spec.rb
puppet-8.4.0 spec/integration/l10n/compiler_spec.rb
puppet-8.4.0-x86-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.4.0-x64-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.4.0-universal-darwin spec/integration/l10n/compiler_spec.rb
puppet-7.28.0 spec/integration/l10n/compiler_spec.rb
puppet-7.28.0-x86-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-7.28.0-x64-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-7.28.0-universal-darwin spec/integration/l10n/compiler_spec.rb
puppet-8.3.1 spec/integration/l10n/compiler_spec.rb
puppet-8.3.1-x86-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.3.1-x64-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-8.3.1-universal-darwin spec/integration/l10n/compiler_spec.rb
puppet-7.27.0 spec/integration/l10n/compiler_spec.rb
puppet-7.27.0-x86-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-7.27.0-x64-mingw32 spec/integration/l10n/compiler_spec.rb
puppet-7.27.0-universal-darwin spec/integration/l10n/compiler_spec.rb