Add failing test for retrieving a need from the API
Present a single need.
Split out test classes for listing and showing.

Their test fixtures have very little in common, and splitting the
fixtures apart would involve multiple nested levels of context,
which makes the tests that bit more confusing.
Refuse to create needs with defined IDs.

We don't want to allow need IDs to be assigned by API clients, and it's
clearer to refuse these requests entirely than to silently overwrite a
specified need ID with our own.
Update needs through a PUT request.

Strictly speaking, we shouldn't be using PUT for partial updates and
just accepting complete representations, but for now it's not worth
fighting with Rails, especially since they're bringing in support for
the PATCH verb in Rails 4.
Merge pull request #10 from alphagov/view-edit-needs

View and edit needs
List just the basic information about each need in result sets

So that we can include more fields, like the event
history, in single need responses, we should
return fewer items of information in the result
set responses.

This creates a new BasicNeedPresenter which returns
only the role, goal, benefit and organisations for
a need. This changes the NeedResultSetPresenter to
present needs using the basic presenter instead of
the full presenter.
Add a decorator to calculate changes between snapshots

This decorator can be used on any class which
responds to the `snapshot` method, and will work
out the changes between the snapshot in the decorated
object and the snapshot in a previous revision.

A lot of this code is borrowed from the DiffEnabledAction
class in Panopticon which has a similar purpose.
Decouple the OrganisationPresenter from NeedPresenterTest

In the need presenter unit test, we should solely 
be testing the behaviour of NeedPresenter, not the
other presenters it may invoke.

This adds a new method in the test to stub out a
presenter and return back a string, which we can
assert for in the response.
Rename the revision decorator and compare correctly against nil

Rename the revision decorator to make it a bit less
ambiguous.

When a revision is compared against nil, all attributes
from the current revision should be returned as changes.
Sort revisions by created_at descending

This includes a fix for the Need unit test where
the timestamps don't return in the same order
consistently.
Add a need decorator to return pairs of revisions

Add a decorator method to return revisions as pairs 
with their previous revision for comparison.

This didn't feel like it was a model concern, nor
did it fit cleanly to be a controller concern whilst
maintaining a single need parameter to the 
NeedPresenter.

This also includes a new FactoryGirl factory for
a need revision.
Return revisions in the response for a single need

Return the author details, action type, timestamp 
and a hash of changes for each revision in the
response for a single need.
Add a comment to the NeedDecorator revisions_with_changes method
Only show the most recent 5 revisions inside a need response
Refactor revision functionality.

The big difference here is that, instead of the decorator pairing up
revisions with their predecessors to be passed into a method further
down the line, we now have a Changeset class, which decorates a need
revision and includes knowledge of which revision came before it, so it
can have a no-argument method to calculate the changes. This means the
presenters don't need to know about how to interpret a pair of
revisions.

The names of `NeedDecorator` and `RevisionDecorator` also weren't very
descriptive as to what they were actually *doing* to decorate needs and
revisions, hence becoming `NeedWithChangesets` and `Changeset`.
Change code to fix flaky test.

functional needs_controller_test line 32 was failing due to the return
order of the needs.

Was getting 3 different return orders: 1,2,3,4,5; 2,1,3,4,5; 3,4,1,2,5.
Make Changeset a model and remove delegation

Fix tests to match new structure.

See: https://github.com/alphagov/govuk_need_api/pull/12#issuecomment-27677787
Remove sort of needs in Need Controller: Sort in tests
Merge pull request #12 from alphagov/changeset-refactor

Refactor revision functionality.