-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for reports #6177
Add tests for reports #6177
Conversation
93aa1c2
to
b9ab74d
Compare
This task has been renamed in Whitehall [1]. Dependant on: alphagov/whitehall#6177 --- Trello: https://trello.com/c/LCR0Am73/2541-5-enable-continuous-deployment-for-whitehall [1]: alphagov/whitehall#6177
This was refactored two years ago and doesn't actually run due to [line 13][1] as the `delete` call throws an `ArgumentError` for the `PathName` instance. This hasn't been fixed / noticed in all that time so assume this report is no longer needed. [1]: https://github.com/alphagov/whitehall/blob/7c2c8919a6fc1a4432d7c3caef3c4b1b737779cc/lib/reports/draft_publications_report.rb#L13
f16957a
to
cc4ad3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good job bringing the test coverage up, Peter 👍 I have a few questions and suggestions below.
363a057
to
555f951
Compare
This commit also standardises them by: * creating constants to store CSV headers * using the apps tmp directory as it feels more appropriate than the global tmp directory
57d9a0e
to
68d1598
Compare
Thanks for the review @ChrisBAshton! Think I've addressed everything. I was getting some strange behaviour when I was running the rake tests locally (tasks running twice, when only invoked once) and have narrowed it down to the tasks themselves being initialised more than once. I've updated this in the last commit. |
Previously this rake file was quite disorganised with inconsistencies like tasks being in the wrong name space. This commit: * Moves tasks to the correct namespace * Renames some tasks to try and gain some naming consistency * Moves redirect routes and special routes to their own model which will help with testing in the next commit
Adds tests to all (non-dry run) rake tasks. This commit also adds a factory attribute to file attachments which makes them more realistic (accesible = `false` instead of `nil`)
This task is needed to satisfy the e2e tests setup. We can remove it once this is merged, and the e2e tests PR is merged [1]. [1]: alphagov/publishing-e2e-tests#422
Not checking if there are any pre-loaded rake tasks was causing tasks to be initialized twice, resulting in them running twice for every single invocation.
68d1598
to
dccacfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @1pretz1 👏
This PR adds tests for some (of the many) rake tasks. I focused mainly on the Publishing API rake tasks as they were the least tested and high value. There has also been some refactoring to try make navigating and adding new publishing api tasks a bit easier.
Trello:
https://trello.com/c/LCR0Am73/2541-5-enable-continuous-deployment-for-whitehall