atom-ruby-test
atom-ruby-test copied to clipboard
enhancement: add {test_name} variable to use with --name option
trying to use cmd-ctrl-r (run test at cursor) with minitest and it doesn't like the file:line-number syntax (i even tried the m gem but there is an issue with that and the current version of minitest).
using:
ruby -I test {relative_path} --name {test_name}
would work, but it would need to parse out the quoted string at the cursor, snake_case it and prefix with test_, for example:
test 'should create with valid creds' do
would yield test_should_create_with_valid_creds
i'm an atom package developer noob, but i'd be willing to help out if you are stretched.
regards, tony.
so i found a fork of the m gem which works with minitest-5, and was able to use that as a work around for this:
add this to your Gemfile:
group :test do
gem 'm', git: 'https://github.com/ANorwell/m.git', :branch => 'minitest_5'
end
and use this for your run configuration:
bundle exec m /path/to/project/{relative_path}:{line_number}
would still prefer to have a {test_name_at_line} variable, but this gets me thru...
Thanks @tony-kerz, the fork of the m gem works well.
hey @GerritWanderer glad that works for you.
the other option i recently stumbled across is using zeus which can run a test at the cursor as well.
check out the section on zeus in this document: http://brendankemp.com/essays/atom-is-ready-to-be-your-editor/
i have trended to this solution as i have never used zeus before and it is also pretty cool in terms of eliminating start up wait times for a ruby process. check it out here: https://github.com/burke/zeus
regards, tony.
I'll try Zeus out. This is an great article by Brendan Kemp, I already discovered some new features :)
I had made a pr https://github.com/moxley/atom-ruby-test/pull/49 to run test based on regex.
@roychoo: Did your PR cover tests with spaces? I used to write my tests like this:
test "awesome feature" do
...
end
I the settings I changed the single test command to ruby -I test {relative_path} -n /{regex}/ but this did not trigger my test. I think minitest only recognise valid ruby method names in the regex. It would be great if spaces get replaced by underscore. If I run the test on the console with ruby -I test /path/to/test.rb -n /awesome_feature/ the test run.
For those landing on this issue like me, I made a Pull Request attempt (#117) for the annoying limitation mentioned above by @roychoo