-
Notifications
You must be signed in to change notification settings - Fork 86
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
Remove TaskSkill reliance on ja_resource/canary #964
Remove TaskSkill reliance on ja_resource/canary #964
Conversation
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.
A minor change in the tests is needed, but otherwise looks great.
Don't forget to rebase and squash the commits as you make the change, for quick approval and merging from my side.
changeset = %TaskSkill{} |> create_changeset(%{task_id: task.id}) | ||
refute create?(user, changeset) | ||
task_skill = %TaskSkill{task_id: task.id} | ||
refute create?(user, task_skill) |
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.
In "real-life", this function is being called from CodeCorps.Policy
using a params map (with string keys) as the second argument.
However, the tests call it with a %TaskSkill{}
with atom keys as the second argument.
The real life part is indirectly tested from the controller tests, and the tests you wrote here still pass, becase in CodeCorps.Policy.Helpers
, we have
def get_task(%TaskSkill{task_id: task_id}), do: Repo.get(Task, task_id)
def get_task(%{"task_id" => task_id}), do: Repo.get(Task, task_id)
However, these tests leave room for a potential bug being introduced, so I would replace the second argument in create?
tests with a params map. Note that the delete?
tests do correctly use a %TaskSkill{}
as the second argument, so there isn't anything to change there.
58cfd2c
to
c3093b6
Compare
@begedin Thanks for the feedback! The branch has been updated :) |
@landongrindheim Thank you. Awesome work! |
🙌 , as always. 🥇 |
Removes reliance and ja_resources and canary for the TaskSkillController
References
Closes #912
Progress on: #864