Fix lookup of originating user in edited_by_human?

This method looks for the last user recorded as having edited the
mapping, and tries to tell if the user is human or a robot. The
'originator' is an alias for the version's 'whodunnit', and we store
the user's name in this field rather than the user id (which PaperTrail
defaults to). We need to try to find the user by name rather than id,
otherwise this method will never return true in real use.

The tests for this method were passing before because in model specs
the PaperTrail config was not being correctly set, so it was saving
the user's id in the whodunnit field rather than the name, so find_by_id
was able to find the user.

Controller specs are unaffected by this change, because PaperTrail
prefers to have its config on the ApplicationController and will
always use that configuration when we go through the controller. In
controller specs we have always set whodunnit to the name, so in that
context our tests are still valid.

- Add as_user to the mapping factory, so that we can specify a user
  by whom the mapping should appear to be created. The user defaults
  to a stub user if it is not given, none is already set and
  PaperTrail is enabled.

- Create a Transition::History module, so that we have somewhere to
  put methods which will make it easier to do the right thing in future
Clear up PaperTrail config consistently between tests

- disable PaperTrail again after specs with versioning: true
- reset config before each feature as well
Ensure that PaperTrail config is set before saving a mapping

If PaperTrail is enabled, we should make sure that we configure it
consistently wherever it is used. This will make it much easier to
use it correctly in future, and clearly sets out what we expect to
be set.

We have so far been using the correct configuration everywhere in
our code, but often not in tests, especially non-controller specs or
anywhere which requires mappings to be created as setup with
versioning: true.
Move as_a_user into Transition::History

...from Whitehall mappings CSV import
Use as_a_user in 2 tests for precision

This is clearer than setting the user and then making changes to
mappings in setup.
Remove a redundant mapping factory as_user use

We only need to use this now when we care about the user; if we don't
care who it is then the factory will use a stub user for the whodunnit.
Move logic to ensure config into Transition::History

It isn't a concern of the Mapping model to know when or how PaperTrail's
config should be set. It just needs to be able to be confident that the
config is ok before saving a mapping.
Rename method more concisely with !

The ! seems appropriate since it will raise an exception if the user
config is not set when it should be. This method is now in the History
module so its name doesn't need to refer to papertrail.
Find mapping's last editor by id, not name

User.name isn't guaranteed to be unique, either here or in signon,
and names can change.
Merge pull request #227 from alphagov/fix_whitehall_robot_overriding_humans

Fix Whitehall import overriding edits made by humans