Commit Graph

7 Commits

Author SHA1 Message Date
Javi Martín
614b4fbe4c Add and apply FactoryBot/AssociationStyle rule
This rule was added in rubocop-factory_bot 2.23.0. We were following it
sometimes, and sometimes we were not.
2023-09-08 13:52:54 +02:00
rgarcia
68a2281203 Refactor segment constant into a class method
We're going to make it dynamic using the geozones. Besides, class
methods can be overwritten using custom models, while constants can't be
overwritten without getting a warning [1].

Makes the definition of segments with geozones a little cleaner. I
think it’s worth it, compared to the slight memory gain of using a
constant [2].

[1] warning: already initialized constant UserSegments::SEGMENTS

[2] https://stackoverflow.com/questions/15903835/class-method-vs-constant-in-ruby-rails#answer-15903970
2021-12-20 15:07:25 +01:00
Javi Martín
1973c61552 Simplify creating notifications in specs 2019-09-30 14:10:46 +02:00
Javi Martín
a0ee0e661f Fix missing sequences in notification factory
If we don't define a sequence, `n` becomes an object instead of a
number.
2019-09-23 18:01:44 +02:00
Javi Martín
fc1a89e966 Use dynamic attributes in factories
Static attributes are deprecated since factory bot 4.11; we haven't
upgraded yet but now we're ready to do so:

https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11
2019-08-07 19:43:57 +02:00
Javi Martín
d7b9ed1bc4 Use dynamic times and dates in factories (part 2)
Most factories were using dynamic times and dates since commit 0cf799a.
However:

* At the time, commits AyuntamientoMadrid/consul@71f5351 and
AyuntamientoMadrid/consul@a476a30 (which introduced static times/dates
in factories) hadn't been backported.
* The changes in commit 0cf799a overlooked the factory
`proposal_notification`.
2018-09-19 14:21:21 +02:00
Pierre Mesure
cba6cc029e Split factories 2018-08-08 07:20:47 +02:00