moxley / atom-ruby-test

Run Ruby tests, Rspec examples, and Cucumber features from Atom
MIT License
43 stars 36 forks source link

Incorrect detection of test type #54

Closed asusikov closed 9 years ago

asusikov commented 9 years ago

After updating to 0.9.8 rspec files are running by commands for minitest files.

drogar commented 9 years ago

Same issue. I am using the obvious workaround of adding my rspec commands in the settings for minitest.

moxley commented 9 years ago

@asusikov, @drogar: At the top of a typical spec file, do you include a spec helper, like this:

require 'spec_helper'

Or do you do something different to bootstrap RSpec?

drogar commented 9 years ago

I do.

Usually

require ‘rails_helper’

or

require ‘spec_helper’

I noticed the issue on one of the files with require ‘rails helper’

On May 25, 2015, at 10:12 AM, Moxley Stratton notifications@github.com wrote:

@asusikov https://github.com/asusikov, @drogar https://github.com/drogar: At the top of a typical spec file, do you include a spec helper, like this:

require 'spec_helper' Or do you do something different to bootstrap RSpec?

— Reply to this email directly or view it on GitHub https://github.com/moxley/atom-ruby-test/issues/54#issuecomment-105258714.

asusikov commented 9 years ago

I do too.

moxley commented 9 years ago

OK, give this fix a shot.

drogar commented 9 years ago

Perfect. Works for me.

Thanks for such a quick turnaround!

On May 25, 2015, at 10:34 AM, Moxley Stratton notifications@github.com wrote:

OK, give this fix a shot.

— Reply to this email directly or view it on GitHub https://github.com/moxley/atom-ruby-test/issues/54#issuecomment-105263767.

asusikov commented 9 years ago

It works for me too. Thank you for your quick fix!

moxley commented 9 years ago

@drogar, @asusikov Thanks for the feedback!

zinkkrysty commented 8 years ago

What about if you use a relative path:

require File.dirname(__FILE__) + '/../../spec_helper'

I do this for files where I want to run tests without rails environment (but with rspec). Just using require 'spec_helper' doesn't work in this case.

Therefore the plugin is inconsistent with detecting rspec and sometimes (for the same file) it ends up running minitest instead.

What other alternatives to conventions for deteting rspec tests are? I would presume that you can look at the file name and it should end with _spec.rb. Or at least it could give us the possiblity of choosing the default test command for a project.

moxley commented 8 years ago

@zinkkrysty: Detecting spec framework is difficult and error-prone. ruby-test has a setting for choosing your preferred spec framework. Change it to rspec if that is your preferred framework. If you use minitest on some projects and rspec on others, install the https://github.com/danielbrodin/atom-project-manager plugin, then configure each project with it to set the ruby-test preferred spec framework.

zinkkrysty commented 8 years ago

Ok thanks for the info. I agree, it shouldn't hack its way into detecting the right framework, if there isn't an established convention.

I'll take your suggestion with the preferred framework and the project-manager plugin, I didn't know about that.

bronson commented 8 years ago

Hm, detection seems to be failing on my project too.

I don't quite understand what's so hard about determining if it's an rspec project... If an .rspec file exists in the project's root dir, or if spec/spec_helper.rb includes RSpec.configure, then it has to be rspec, no?

Would you accept a PR to improve this?

moxley commented 8 years ago

@bronson: There is logic in https://github.com/moxley/atom-ruby-test/blob/master/lib/source-info.coffee#L124 that checks for an .rspec file. Maybe you can identify the proper course of action to fix the problem.

Of course I accept PRs: https://github.com/moxley/atom-ruby-test#contributing