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

adding support for minitest #49

Merged
merged 1 commit into from
May 25, 2015
Merged

adding support for minitest #49

merged 1 commit into from
May 25, 2015

Conversation

roychoo
Copy link
Contributor

@roychoo roychoo commented Apr 20, 2015

Hi, this is for supporting minitest.
i found it helpful for me, thus creating a PR.
let me know if it is ok.


isMiniTest: ->
editor = atom.workspace.getActiveTextEditor()
cursor = editor and editor.getCursor()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to changing API, this should now be: editor.getLastCursor().

This repeats much of what is on line 34. Can you reuse that logic?

@roychoo roychoo force-pushed the minitest branch 3 times, most recently from 5474d97 to 29f4a0e Compare April 21, 2015 06:16
@roychoo
Copy link
Contributor Author

roychoo commented Apr 21, 2015

thanks for the feedback, already removed the deprecated api getCursor and added more tests

@moxley
Copy link
Owner

moxley commented Apr 23, 2015

This still incorrectly identifies an rspec project as a minitest project. Please clone https://github.com/moxley/atom-ruby-test-samples, and test your changes on the sample rspec project. Make sure it runs the rspec command, and not the minitest one.


isMiniTest: ->
i = @currentLine() - 1
regExp = new RegExp(/^(\s+)(should|test|it)\s+['""'](.*)['""']\s+do\s*(?:#.*)?$/)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Continuing on from the previous comment, this will match both a minitest spec test and an rspec test. That is bad. Instead, you could check the first line of the file, which usually contains require 'spec_helper' for rspec.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a unit-test style minitest file contains a class that inherits from Minitest::Test.

fixing bugs that causes rspec file to match minitest
adding more tests
adding initial tests
adding support for minitest
removing deprecated api

removing console logs
@roychoo
Copy link
Contributor Author

roychoo commented Apr 24, 2015

@moxley it was my mistake. i had made the changes and tested on https://github.com/moxley/atom-ruby-test-samples and i also created a minitest_samples https://github.com/roychoo/minitest_sample and tested on that too. let me know if you want me to send a PR to the samples repo for minitest.

@moxley
Copy link
Owner

moxley commented May 3, 2015

@roychoo I've been thinking about your solution, and I think there is a more simple, flexible way to solve this problem. I've been using project-manager to create separate ruby-test settings for different projects. You can use it to configure your minitest proejcts. All you need to do is install the package, save your project as a project-manager project, edit the settings file, and add the ruby-test settings you want. If your project uses minitest and it has a test directory, configure the "Test *" commands. If your project uses minitest and it has a spec directory, configure the "Rspec *" commands. I can relabel "RSpec" to simply "Spec" through ruby-test, so that it's not specific to RSpec.

@roychoo
Copy link
Contributor Author

roychoo commented May 4, 2015

But I think we still need the regex portion of it? As minitest spec we can run single test thru regex and rspec thru the line number?

@moxley
Copy link
Owner

moxley commented May 7, 2015

Yes, I see your point. That makes sense. I'm trying out your changes on a project that uses minitest. So far, it works well. I'll get back to you soon with some feedback.

@roychoo
Copy link
Contributor Author

roychoo commented May 8, 2015

cool. let me know if you know of any other better way of handling this.

moxley added a commit that referenced this pull request May 25, 2015
adding support for minitest
@moxley moxley merged commit ccc8ffb into moxley:master May 25, 2015
@moxley
Copy link
Owner

moxley commented May 25, 2015

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

Successfully merging this pull request may close these issues.

2 participants