2

I have a test that started failing in Buildkite...

 Failure/Error: it { is_expected.to eq('Del 17 al 23 de febrero de 2019 (7 días)') }
 
       expected: "Del 17 al 23 de febrero de 2019 (7 días)"
            got: "Del 17 al 23 de Febrero de 2019 (7 días)"

Note that "febrero" is expected in all lowercase, but it's capitalized. The problematic string is generated with this code...

  let(:view) { ApplicationController.helpers }
  
  # ...

  view.l(payslip.end_date, format: '%e de %B de %Y', locale: 'es')

This same test is still working in my development environment. Previously it also worked in Buildkite, and no related code was changed when it started to fail. Moreover, if the Buildkite failed test is retried, sometimes it works.

Any idea on what could be happening?

Xavi
  • 583
  • 1
  • 7
  • 13

2 Answers2

0

Have you checked your locale settings? Seems like the locale setting is getting switched up between the tests. So depending on the order in which the tests are run the locale may or may not be the one you require on Buildkite. You locale setting on your local machine and for the test might be the same. That is why the test works correctly on the local machine but not on Buildkite

TheGeorgeous
  • 3,927
  • 2
  • 20
  • 33
  • I haven't checked the locale in Buildkite, but note that the locale is set explicitly in the call to `l` (the alias for `localize`), so I think it shouldn't matter which locale is set. Besides, I can't find a capitalized "Febrero" anywhere in our code or rails-i18n (https://github.com/svenfuchs/rails-i18n/search?p=1&q=Febrero) – Xavi Nov 03 '20 at 08:09
0

The problem was that we use the ice_cube gem and it modifies the translation strings.

We fixed it by using the fork linked from markedmondson's comment in the GitHub issue.

Xavi
  • 583
  • 1
  • 7
  • 13