Skip to content
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

enhancement: add {test_name} variable to use with --name option #26

Open
tony-kerz opened this issue Sep 16, 2014 · 7 comments
Open

enhancement: add {test_name} variable to use with --name option #26

tony-kerz opened this issue Sep 16, 2014 · 7 comments

Comments

@tony-kerz
Copy link

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.

@tony-kerz
Copy link
Author

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...

@GerritWanderer
Copy link

Thanks @tony-kerz, the fork of the m gem works well.

@tony-kerz
Copy link
Author

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.

@GerritWanderer
Copy link

I'll try Zeus out. This is an great article by Brendan Kemp, I already discovered some new features :)

@roychoo
Copy link
Contributor

roychoo commented Apr 20, 2015

I had made a pr #49 to run test based on regex.

@factor4
Copy link

factor4 commented Jul 22, 2015

@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.

@brilnius
Copy link

brilnius commented Jan 7, 2021

For those landing on this issue like me, I made a Pull Request attempt (#117) for the annoying limitation mentioned above by @roychoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants