Support new Rails 5 syntax
Opened this issue · 6 comments
Beginning with Rails 5.0.0, testing is expected to be run via the rails test
command rather than rake test
, with rake test
being fully deprecated at some point in the future. The effect of this today is that paths and test names passed via rake
appear to be ignored, instead running the entire suite.
Not sure if the best solution here is to add a new (defcustom use-rails-5-syntax)
or try to infer the appropriate syntax based on the project.
More on the new syntax can be found here. One upside is that the new runner accepts line numbers for running individual tests, which should obviate the need to regex for the test name.
would be awesome to infer it from the project, not sure how we would be able to do that tho
rails -v
gives you the version, which you could then test against. And rails -h
gives you all the commands to which rails
responds, which could be used to see if "test" is one of the supported commands.
The main concern I have with both of these is that they're slow—too slow to run before each test run. But they might be fine for setting some sort of project level config, something like minitest-infer-and-write-config
that then sets defs in .dir-locals.el
. Awkward, and would need to be rerun if you upgrade or downgrade Rails, but maybe not so bad? Wonder if there are any other Emacs libs that do something similar.
@leppert interesting. we need to keep in mind this should also work outside rails, for ruby only projects.
But I guess what you said make sense 👍
Just bumped into this as well using minitest-emacs in spacemacs. Following along. :-)
Setting minitest-use-rails
to t
will use the rails test ...
command.
Setting
minitest-use-rails
tot
will use therails test ...
command.
Indeed. This config is newer than this issue, and solves the original problem. I still think it could be nice to auto-detect a rails project and version to see if rake
or bin/rails
is preferred.