Skip to content

Commit

Permalink
test: address suite flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Mar 17, 2024
1 parent bb1b6ac commit b7b59fa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bridgetown-core/script/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ then
set -x
ruby -S bundle exec ruby -I test \
"test/test_resource.rb"
time BYPASS_RESOURCE_TEST=true SEED=5678 ruby -S bundle exec \
time BYPASS_RESOURCE_TEST=true SEED=1 ruby -S bundle exec \
rake TESTOPTS=$testopts test
else
set -x
Expand Down
12 changes: 12 additions & 0 deletions bridgetown-core/test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ def symlink_if_allowed(target, sym_file)
rescue NotImplementedError => e
skip e.to_s.magenta
end

def reset_i18n_config
I18n.enforce_available_locales = false
I18n.locale = nil
I18n.default_locale = nil
I18n.load_path = Gem.find_files_from_load_path("active_support/locale/en.*") # restore basic translations
I18n.available_locales = nil
I18n.backend = nil
I18n.default_separator = nil
I18n.enforce_available_locales = true
I18n.fallbacks = nil if I18n.respond_to?(:fallbacks=)
end
end

class FakeLogger
Expand Down
12 changes: 0 additions & 12 deletions bridgetown-core/test/test_locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
require "helper"

class TestLocales < BridgetownUnitTest
def reset_i18n_config
I18n.enforce_available_locales = false
I18n.locale = nil
I18n.default_locale = nil
I18n.load_path = nil
I18n.available_locales = nil
I18n.backend = nil
I18n.default_separator = nil
I18n.enforce_available_locales = true
I18n.fallbacks = nil if I18n.respond_to?(:fallbacks=)
end

context "similar pages in different locales as specified in filename" do
setup do
reset_i18n_config
Expand Down
1 change: 1 addition & 0 deletions bridgetown-core/test/test_ruby_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class TestRubyHelpers < BridgetownUnitTest
def setup
reset_i18n_config
@site = fixture_site
@site.read
@helpers = Bridgetown::RubyTemplateView::Helpers.new(
Expand Down

0 comments on commit b7b59fa

Please sign in to comment.