Commit Graph

9 Commits

Author SHA1 Message Date
Javi Martín
4a80653d2f Remove redundant checks for array size
If we check the exact contents of the array, checking the size is
implicit.
2019-09-24 20:50:48 +02:00
Javi Martín
66334b5757 Add globalizable tests for all translatable models
So now we test in depth at the model level, and can be a bit more
relaxed about integration tests for translations.

Note we're defining some extra factories to make sure all translatable
attributes with presence validation rules are mandatory. This way we can
simplify the way we obtain required fields, using `required_attribute?`.
Otherwise, fields having an `unless` condition in their presence
validation rules would count as mandatory even when they're not.
2019-09-23 18:01:44 +02:00
Javi Martín
41c99d9b27 Let Globalize use I18n locale
This is a mistake I made in commit f2ef27d3. Back then I thought we
needed to keep Globalize.locale and I18n.locale in sync, but the truth
is it automatically happens when setting Globalize.locale to nil.

So now we can use I18n.with_locale (at least in the tests) and forget
about Globalize, which will make it easier to switch to Mobility in the
future.
2019-09-23 18:01:44 +02:00
Javi Martín
dadbf873ba Order translations using ruby
Joining the translations table caused duplicate records to appear.
Ordering with SQL is simply too hard because we need to consider
fallback locales.

Thanks Senén for providing most of the tests in the poll spec.
2019-06-03 18:35:59 +02:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Bertocq
198ff0cd1f Use updatable slug factory trait to sluggable concern
Slugs should only be updated on certain conditions, we need a trait that
meets that conditions and the name of the trait passed as a mandatory &
named argument on the sluggable concern
2018-02-04 23:04:48 +01:00
Bertocq
3e5b13ae4d Enable RSpec/LetBeforeExamples cop & fix issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
2018-01-07 02:28:06 +01:00
Bertocq
512059e021 Increase Budget, Heading and Group model specs to cover slug uniqueness
Why:

* Slug must be unique among:
 1. Budget slug: among other budgets
 2. Group slug: among other groups from its budget
 3. Heading slug: among other headings from all the groups from its budget

How:

* Adding checks for all possible scenarios on each model specs
2017-07-05 12:33:17 +02:00
Bertocq
73e0a5a88d Add to Budget Budget::Heading Budget::Group specs the sluggable shared example
Why:

* Those classes have a slug attribute that needs to be filled

How:

* Just adding the shared example to Budget model spec, and creating the model spec file for Heading and Group to include it as well
2017-07-04 18:40:54 +02:00