Files
nairobi/app/models
Bertocq 7cfa7b18f9 Validate Newsletter segment_recipient value
Why:

A Newsletter can only be sent if the are available user recipient emails
and that means the `segment_recipient` value actually corresponds to a
function on the UserSegments class.

We could rely on the UserSegments::SEGMENTS constant as the list of
possible user segments functions that a Newsletter can use to gather
emails, so any value not included in that hash would not be valid.

But to be 100% sure the newsletter can get a recipients_list we should
just check if the UserSegments class has a method with same name as the
`segment_recipient` value.

How:

* Adding an validation method that checks if UserSegment has a method
with same name as the `segment_recipient` value.
* Adding an scenario to the Newsletter model spec to check this
2018-02-21 11:46:16 +01:00
..
2017-07-18 13:07:30 +02:00
2015-07-15 13:32:13 +02:00
2017-11-17 13:14:03 -04:00
2017-07-25 13:01:03 +02:00
2016-01-26 18:10:47 +01:00
2017-10-17 22:00:00 +02:00
2016-11-23 19:19:19 +01:00
2016-05-10 18:31:50 +02:00
2017-04-06 16:25:07 +02:00
2018-02-19 11:09:19 +01:00
2016-05-30 13:55:12 +02:00
2015-08-08 12:56:41 +02:00
2017-12-15 19:21:02 +01:00