Skip to content

Commit a6f2b56

Browse files
committed
(PUP-11022) Enable i18n for gettext spec
Fix order dependent test when running spec/integration/application/plugin_spec.rb followed by spec/unit/gettext/config_spec.rb. The former disables i18n due to the settings hook, and that breaks assumptions made by the latter.
1 parent a3246a6 commit a6f2b56

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/unit/gettext/config_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
Puppet::GettextConfig.delete_all_text_domains
2828
end
2929

30+
# These tests assume gettext is enabled, but it will be disabled when the
31+
# first time the `Puppet[:disable_i18n]` setting is resolved
32+
around(:each) do |example|
33+
disabled = Puppet::GettextConfig.instance_variable_get(:@gettext_disabled)
34+
Puppet::GettextConfig.instance_variable_set(:@gettext_disabled, false)
35+
begin
36+
example.run
37+
ensure
38+
Puppet::GettextConfig.instance_variable_set(:@gettext_disabled, disabled)
39+
end
40+
end
41+
3042
describe 'setting and getting the locale' do
3143
it 'should return "en" when gettext is unavailable' do
3244
allow(Puppet::GettextConfig).to receive(:gettext_loaded?).and_return(false)

0 commit comments

Comments
 (0)