-
Notifications
You must be signed in to change notification settings - Fork 45
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
Allow setting current resource in tests #149
Allow setting current resource in tests #149
Conversation
lib/graphql_devise/schema_plugin.rb
Outdated
controller = context[:controller] | ||
resource_names = Array(context[:resource_name]) | ||
|
||
if context[:current_resource].blank? |
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.
Why not the shorter version?
context[:current_resource] ||= resource_names.find do |resource_name|
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.
Looks good, just a small suggestion and don't forget to remove commented code.
This is super cool -- I see that its closed now but is there a way for new users of the gem to know about how to properly test? Maybe a readme section could be added show the methods included in this PR, or at least a link from readme to the above? |
Hi @keithmgould , I think that is a great suggestion! |
I can also do that if no one has done it until I get some time. Important thing to note here is that this is a quick fix that works for all but one scenario, passing no |
Allows setting
current_resource
on specs usingwith graphql schema test
shared contextCloses #138