Working on https://github.com/thoughtbot/administrate/pull/1941, I'm having issues with the way authorization is currently tested. I'm trying to solve this problem first before I proceed with the linked PR.
Sorry, this is a big PR :-( To make reviews easier, I have put some effort into splitting it into commits with individual descriptions that make as much sense as possible in isolation. I haven't created individual PRs for each because I think that would leave things in a weird intermediate state.
Although there are some changes to Administrate proper, this PR is actually about the specs and the example app. The commits can be grouped as follows:
- Actually get Punditize working in the example app (one commit)
- Changes to authorization (two commits):
- Allow override of fragments of the collection partial.
- Reformulate authorization in example app.
- Changes to navigation (two commits):
- Remove line items from navigation.
- Bring product meta tags into navigation.
- Minor tweaks (three commits):
- Destroy payments before customers or they'll stay.
- Create some payments on seed.
- Less confusing example of authorization.
The only change to Administrate proper is in the first commit of point 2 above, where I extract some parts of the collection partial into smaller partials, allowing them to be overriden more easily.
The example app gets new a new feature where users can "become" a customer with a single click. This provides a simple form of authentication that we can use to test authorization. This feature is visible in the Customers collection: