alphagov/whitehall — pull request #1595 by tekin (2014-07-09 13:52:17+00:00)
Title: Extract edition scheduled/unschedule service objects

This is a precursor to reworking scheduled publishing to use scheduled sidekiq jobs. Service objects are extracted for scheduling, force scheduling and unscheduling. This will make it easier to add the code to queue and unqueue scheduled sidekiq jobs for publishing the editions without fear of side-effects. It also completes part of the work of [this story](https://www.agileplannerapp.com/boards/173808/cards/4819), removing one of the points at which random exceptions are thrown during workflow actions. Specifically the weird validation dance caused by state transitions handled by this method:

```ruby
def scheduled_publication_must_be_in_the_future?
(draft? && state_was == 'draft') || submitted? || (state_was == 'rejected' && rejected?)
end
```

Story: https://www.agileplannerapp.com/boards/173808/cards/3416