-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve controller template when no action #2399
Conversation
Made with @tsleal29, @yann120, @fwuensche and @musait |
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.
Amazing, thanks!
Just a few edits away from getting it done.
<% namespaced_path = regular_class_path.join('/') -%> | ||
<% if actions.empty? -%> | ||
describe "GET /index" do | ||
it "returns http success" do |
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.
Not specifically related to this pull request.
I'm slightly opposed to adding "returns http success" in request specs. From my point of view, they should test more than just http statuses, and providing this as a reference example in the template is promoting a dubious practice.
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.
Indeed. Maybe I can update the template for that as well? Do you have an idea regarding what we can provide?
I'm thinking to exists
or is reachable
(I have a preference for the second option)
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.
Maybe "returns a list of #{class_name.pluralize.downcase}"
? At least this is what an "index" originally means.
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.
update the template for that as well
That would be very helpful!
fix pr according to @pirj remarks
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.
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.
Thanks!
Improve controller template when no action
Fix for #2375
A generated file looks like this: