Why:
Newsletter attribute `segment_recipient` is an integer to be used as
enum. There's no advantage to store a number instead of an string if the
ammount of elements in the table is not going to be huge, or we can take
advantage of using an enum.
Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS
would be a maintenance burden.
How:
* Migration to change segment_recipient column from integer to string
* Removing enumeration from Newsletter model class
* Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients
or integer values
Why:
UserSegments are not only used for Newsletters or Email downloads, but
also for internal Global Notifications. We don't want to have that scope
hardcoded inside UserSegments as users that have opted-out from the
newsletter should still be recipients of global notifications.
How:
Removing the scope from the UserSegments `all_users` method that acts as
base for all the other segments. Including that `newsletter` scope only
on the places that is relevant:
* When listing recipients for a newsletter
* When downloading a listing emails that can be newsletter recipients
Also updated relevant tests
This makes tests run a tiny bit faster and cleans up the logs when
running specs locally
We can still configure rspec to run the profiler when we go into improving spec performance
We were seeing a log message when running specs locally
```
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
```
As Coveralls is mainly used in Travis CI, we do not need to load it in
every spec run
We were seeing this warning when running specs
`spec/features/admin/budgets_spec.rb:322: warning: circular argument
reference - phase_kind`
This commit should fix the warning
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
Milestones should be listed ordered by publication date instead of
creation date. The spec was creating only one milestone and not even
expecting the descriptions to be present in the page.