You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
provide a thin wrapper around Rails’ integration tests, and are designed to drive behavior through the full stack, including routing (provided by Rails)
One confirmation that the use of non-generated paths is preferred (with a single edge case exception) is in rspec-rails examples:
[Generating Paths and URLs from Code] ... reduces the brittleness of your view
however, in specs it is the other way around. To keep the public API paths intact, you must use direct paths in request specs, or write additional routing specs.
Suggestion
Add a cop that would flag usages of path/URL helpers in request specs.
Request specs:
One confirmation that the use of non-generated paths is preferred (with a single edge case exception) is in rspec-rails examples:
Another is Rails testing guides:
A common way is to use the path helpers:
Rails guides mention that:
however, in specs it is the other way around. To keep the public API paths intact, you must use direct paths in request specs, or write additional routing specs.
Suggestion
Add a cop that would flag usages of path/URL helpers in request specs.
cc @koic WDYT?
The text was updated successfully, but these errors were encountered: