Add missing test coverage for edition ordering

These ordering scopes fallback to ordering by document_id to prevent
editions jumping around when they are re-editioned with minor changes.
See https://github.com/alphagov/whitehall/commit/b2abdff5
Fix Edition.in_reverse_chronological_order

It was returning the wrong ordering when editions shared the same
timestamp and document.
Refactor Edition#in_organisation to use org ID

Using the slug just meant an unnecessary join to the organisations
table.
Include supporting pages in Edition#in_organisation

Supporting pages don't have direct associations to organisations.
Instead they inherit their organisations from related policies. This
commit changes the behaviour of #in_organisation to check the policy
organisations in the query.
Log network traffic on Capybara::Poltergeist::TimeoutError

We've been having a problem with one poltergeist feature which regularly times out.
This monkey-patches poltergeist to catch timeout errors and log the network traffic
before raising, giving us a chance of debugging exactly what's happening.
Speculative fix for intermittently failing feature

Scenario in question is features/document-collections.feature:33

This scenario often fails on the step:
"And I see that "Feeding Wombats" is before "Wombats of Wimbledon" in the document collection"

I'm thinking that this might be because the post made in
"And I move "Feeding Wombats" before "Wombats of Wimbledon" in the document collection"
was aborted before completing by navigating straight to the preview page. If I'm right,
waiting for the loading spinner to go should fix this.
First stage supporting page cleanup

This enables us to remove duplicate migrated supporting pages from the
revision history. Note this is performing a hard-delete on both the
editions and their supporting pages.
Merge pull request #1100 from alphagov/log-network-traffic-on-poltergeist-timeout-error

Log network traffic on Capybara::Poltergeist::TimeoutError

[Working towards https://www.pivotaltracker.com/story/show/61376422]
Merge pull request #1103 from alphagov/test-fixes

Speculative fix for intermittently failing feature

https://www.pivotaltracker.com/story/show/61376422
Second step: repair version numbers/change notes

This fixes the major/minor flag, change notes and numbering of
supporting pages. The intention is the following:

1. The first migrated version is the only one that is designated as
a major change.
2. Change notes for migrated versions are cleared
3. All migrated versions get a published_version of "1.0"

The reasoning is as follows:

We want to be able to include the change history of supporting pages
along side the parent policy, but at the moment, all editions are
marked as being  a major change and have adopted the change notes of
the policy. This means that a combined change history would include
duplicate change notes and would include each revision of the
supporting pages, regardless of whether there were any actual changes
to the page. The above chnages mean that only the very first migrated
edition will be included in the change history (the only major
change). This will result in a sane history, as we can rely on the
parent policy supplying any relevant change notes for the supporting
pages created prior to migrating them to editions.

The change notes and minor_change flag are not updated for any
supporting page editions created after the migration, as these would
have been revised by an editor and should therefor have sensible
minor_change/change note values. We do however re-number these
editions, as they will be incorrectly numbered - because the migrated
editions had nil version numbers, the revised editions would have been
designated as the first published version and given a version number
of "1.0".
Merge pull request #1109 from alphagov/include-supporting-pages-in-admin-when-filtering-by-org

Include supporting pages in admin when filtering by org

[Fixes https://www.pivotaltracker.com/story/show/61539712]
Make EditionPublisher reject scheduled editions
Add ScheduledEditionPublisher

Scheduled editions should bypass validation when being published to
ensure that a change in the validation rules inbetween being scheduled
and the scheduled publication date doesn't prevent the edition being
published.

This service must only be used for scheduled editions and it makes
appropriate checks to that effect.
Use ScheduledEditionPublisher in publishing worker
Update repair_version_history to fix timestamps

Once the version numbers have been corrected, we can fix and
re-calculate the publishing timestamps for the editions by correcting
the first_published_at timestamp and saving the edition. The
public_timestamp will automatically be re-caluclated by the
set_public_timestamp callback on the model.
Merge pull request #1112 from alphagov/publish-invalid-scheduled-editions

Publish invalid scheduled editions

https://www.pivotaltracker.com/story/show/61640312
Remove unneeded code from statistical data set row

It was overriding a lot of methods defined in its parent class without
actually changing the behaviour.
Add locale column to attachments
Allow a development on govuk_frontend_toolkit

You can set the FRONTEND_TOOLKIT_DEV environment variable to use a local
copy of the govuk_frontend_toolkit_gem.
rake task to cleanup supporting pages