Add more comprehensive testing for publications controller #338
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #337
This PR gives more comprehensive testing for the PublicationsController. It is the first PR for issue #337. Later PRs will involve creating a superficial CRUD testing shared examples for the different publication types and removing the redundant testing for those controllers.
Since we do not have a Publications model, and since all of the publication types inherit their CRUD methods directly from the parent controller, we are testing the PublicationsController through its direct child controller, BooksController. We are testing for user authentication and the Create, Index, Update, and Destroy methods defined in PublicationsController.
The file spec/support/helpers/login_helpers_for_unit_tests.rb was created in PR #323, but as that has not been merged in at the time of the PR creation, I have recreated it here in this PR. I've added a
login_as_admin
method in the helper and added a line that will log out any admin user from an admin role when they are logging in as a submitter of a work.